postcss / sugarss

Indent-based CSS syntax for PostCSS
MIT License
707 stars 39 forks source link

Import rules not working with sugarss #13

Closed esiao closed 8 years ago

esiao commented 8 years ago

Using sugarss parser with postcss-import or precss (postcss-partial-import) fails. Both plugins are complaining about missing semicolons and won't import the file.

Since sugarss gets rids of the semicolon for the best I would say that it may be a mater of execution ? sugarss parser should be executed before the postcss plugins ? Or am I doing something wrong ?

var plugins = [
  precss(),
  short(),
  cssnext({compress:true}),
  lost(),
  calc(),
  reporter()
];

gulp.task('styles', function() {
  gulp.src(config.src)
    .pipe(cssGlobbing({
      extensions: ['.sss']
    }))
    .pipe(postcss(plugins), {parser: sugarss})
    .pipe(rename('style.css'))
    .pipe(gulp.dest(config.dest))
    .pipe(browserSync.reload({stream: true}));
});

Kind of error thrown :

postcss-import: [...]/src/sss/main.sss:21:1: [...]/src/sss/general.sss:7:1: Missed semicolon
ai commented 8 years ago

Sorry to say it, but you should ask postcss-import developers.

Unfortunately they always use default CSS parser and it is not a best strategy.

@TrySound do you have any plans to load files with different parser based on file extension?

TrySound commented 8 years ago

@ai For this case we have easy-import stuff.

TrySound commented 8 years ago

However not based on extensions.

TrySound commented 8 years ago

I think we should a bit more extend postcss-import API and include different parsers in easy-import.

ai commented 8 years ago

@TrySound can you send a PR with postcss-easy-import notice to project README?

TrySound commented 8 years ago

@esiao You didn't apply parser, which is postcss option, not .pipe

.pipe(postcss(plugins), {parser: sugarss})
esiao commented 8 years ago

@TrySound that was it... Sorry for the inconvenience. I now have a different issue linked to nesting but it's not related to this plugin.