How to use in Gulp?
- Dominant language
- CSS
- Stars
- 840
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
I've been unable to get cssstyle working in my gulpfile. Maybe I'm just not using it correctly?
Whenever I run my default task, I get this error:
``` JS
[22:39:28] TypeError: undefined is not a function
at Gulp. (/Users/dtigraphics/Git/block-css/gulpfile.js:81:17)
at module.exports (/Users/dtigraphics/Git/block-css/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/dtigraphics/Git/block-css/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/dtigraphics/Git/block-css/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at /Users/dtigraphics/Git/block-css/node_modules/gulp/node_modules/orchestrator/index.js:279:18
at finish (/Users/dtigraphics/Git/block-css/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
at /Users/dtigraphics/Git/block-css/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:52:4
at f (/Users/dtigraphics/Git/block-css/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/node_modules/once/once.js:17:25)
at DestroyableTransform.onend (/Users/dtigraphics/Git/block-css/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/index.js:31:18)
at DestroyableTransform.emit (events.js:129:20)
```
BTW: I'm using `gulp-load-plugins` to auto load all plugins but even require-ing it manually it still isn't working. In my gulp file I have this:
``` JS
gulp.task ('css', ['minify:css'], function (){
processors = [
p.mixins,
p.nested,
p.cssnext({
features: {
customProperties: {
variables: cssVars
},
compress: false,
autoprefixer: {
browsers: ['last 2 version', '> 5%']
},
rem: false,
colorRgba: false,
filter: {
oldIE: false
}
}
}),
plugins.cssstyle(),
p.fakeid()
];
return gulp.src(basePaths.src + assetPaths.css + appFiles.css)
.pipe(plugins.sourcemaps.init())
.pipe(plugins.postcss(processors))
.pipe(plugins.pxtorem(pxtoremOptions))
.pipe(plugins.sourcemaps.write('.'))
.pipe(gulp.dest(basePaths.dest + assetPaths.css));
});
```
Any thoughts? Thanks!
Contributor guide
Research direction
Start with gulpfile.js at the reported line 81 and reproduce the default task using the shown cssstyle() processor configuration. Check how gulp-load-plugins and the manually required plugin expose cssstyle, then verify that the PostCSS pipeline completes without the undefined-function error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100