Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out some scss partials to apply postcss on them #88

Closed
ivangretsky opened this issue Mar 22, 2018 · 1 comment
Closed

Filter out some scss partials to apply postcss on them #88

ivangretsky opened this issue Mar 22, 2018 · 1 comment

Comments

@ivangretsky
Copy link

Good day!

I am building my styles from SCSS with a single entry point main.scss. SCSS partials are included via @import. I need to apply some postcss transformations to some partials after the got compiled to css. As I do not know exactly in which order the transformations in fact happen during the sass compilation process I am not sure if it is even possible. I am not yet skillful enough to debug it myself)) Please give me an advice how to solve this.

Below is my .gulpfile so you can understand what I am after more clear:

var gulp = require('gulp');
var postcss = require('gulp-postcss');
var prefixer = require('postcss-prefixer');
var sass = require('gulp-sass');
var filter = require('gulp-filter');

gulp.task('prefix', function () {
    var plugins = [
        prefixer({
            prefix: 'PREFIXXX-',
            ignore: []
        })
    ];
    
    var f = filter('*.bootstrap.scss', {restore: true});

    // return gulp.src('./static_src/styles/utilities/**')
    return gulp.src('static_src/styles/main.scss', )
        .pipe(sass().on('error', sass.logError))
        .pipe(f)
            .pipe(postcss(plugins))
        .pipe(f.restore)
        .pipe(gulp.dest('./dest'));
});

gulp.task('default', ['prefix']);
@sindresorhus
Copy link
Owner

Probably better to ask on Stack Overflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants