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

Suggest about options #128

Open
gucong3000 opened this issue Jul 6, 2017 · 5 comments
Open

Suggest about options #128

gucong3000 opened this issue Jul 6, 2017 · 5 comments

Comments

@gucong3000
Copy link

gucong3000 commented Jul 6, 2017

The options are becoming more and more complex so that the documents describing it are long. Can we make it compatible with postcss-load-config
See: https://github.com/gucong3000/gulp-postcss#readme

@gucong3000
Copy link
Author

gulp.task('css', function () {
    function callback(ctx) {
        return {
            // Configure parser on per-file-basis.
            parser: ctx.file.extname === '.sss' ? 'sugarss' : false,
            // Plugins can be loaded in either using an {Object} or an {Array}.
            plugins: [
                autoprefixer,
                cssnano
            ]
        };
    }
    return gulp.src('./src/*.css', {
        // Source map support
        sourcemaps: true
    })
        .pipe(postcss(callback))
        // Message repport support
        .pipe(reporter())
        .pipe(gulp.dest('./dest'));
});

In this demo callback function as same as postcss-load-config
image

@gucong3000
Copy link
Author

Config in postcss.config.js or .postcssrc.js, is not same with gulp-postcss at all.
In my fork, they are the same data structures and APIs

@gucong3000
Copy link
Author

So that users can learn one of them, do not have to pay twice times the cost of learning

@w0rm
Copy link
Member

w0rm commented Jul 6, 2017

I see, this is not about changing the docs, but about changing the api. Can't you achieve the same thing with postcss.config.js, why does it have to be inlined? The idea is to only support postcss-load-config when there are no options passed to gulp-postcss. If the options are passed, then postcss-load-config is not even required.

@gucong3000
Copy link
Author

gucong3000 commented Jul 6, 2017

why does it have to be inlined?

In our company, we use postcss under webpack, gulp-postcss use for run stylelint and stylefmt.
So, config in postcss.config.js are css build logic, style lint and fix are write in gulpfile.js.

If the two use the same syntax, it can reduce the cost of learning for the project members.

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