O
O
Oleg Smirnov2017-02-18 10:41:52
gulp.js
Oleg Smirnov, 2017-02-18 10:41:52

Postcss-import - how to inline styles?

I don't know much about postcss, need some help. The essence of the problem: the postcss-import plugin does not inline included files.
gulpfile.js snippet:

var gulp = require("gulp"),
      cssimport = require("postcss-import"),
      postcss = require("gulp-postcss");

gulp.task('styles', gulp.series(styles));

function styles() {
  return gulp.src('src/assets/css/app.css')
    .pipe(postcss(cssimport))
    .pipe(gulp.dest('dist/assets/css'));
}

app.css before build:
@import 'blocks/button/button.css';
app.css after build:
@import 'blocks/button/button.css';
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Smirnov, 2017-02-22
@NetDead

The question is irrelevant. It was in another plugin (postcss-csscomb) that was blocking the import. The script also did not work with the only postcss-import left, but, most likely, the cache was to blame - after a while everything worked as it should. And instead of postcss-csscomb put csslint+cssfmt.

K
Konstantin Velichko, 2017-02-22
@Zoxon

You have connected the plugin incorrectly. Try like this

…
.pipe(postcss([ cssimport() ]))
…

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question