gulp plugin to include css style in javascript file
Use the package manager npm to install plugin.
> node install --save-dev gulp-css-js
var gulp = require('gulp');
var cssJs = require('gulp-css-js')
gulp.task('js', function () {
return gulp.src('./app.js')
.pipe(cssJs()) // plugin
.pipe(gulp.dest('./public'))
});
gulp.task("default", function () {
gulp.watch(['./app.js'], gulp.series(["js"]))
})
var obj = {}
<style src='./result/style.scss'>
$color : #090;
#navbar {
background-color : #999;
color : $color
}
</style>
> gulp
var obj = {}
body {
color : #997
}
/* start style of app file */
$color : #090;
#navbar {
background-color : #999;
color : $color
}
/* end style of app file */
NOTE : if not any html in the file plugin return file without any edit
You can read the documantion to know more about plugin.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.