jonkemp / jonkemp/gulp-inline-css
Use files from stream instead of parsing the document
- Dominant language
- JavaScript
- Stars
- 271
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
I'd love to use something like this:
``` js
gulp.src(['index.html', 'styles/*.css'])
.pipe(if('*.html', inlineCss({
parse: false,
stream: '*.css'
})))
```
Which would just use all CSS files from the stream and it would not parse the template.
Currently I'm trying something like this which of course doesn't work:
``` js
gulp.task('templates', function() {
var assets = useref.assets();
return gulp.src('source/template/*.jade')
.pipe(jade()) // Compile the templates to HTML
.pipe(assets) // Find referenced stylesheets
.pipe(assets.restore()) // Restore HTML file
.pipe(if('*.scss', sass())) // Compile SASS to CSS
.pipe(if('*.html', inlineCss())) // Inline stylesheets
.pipe(gulp.dest('public/')); // Write HTML files to destination
});
```
Basically I want to get referenced SASS files from within the templates, compile them to CSS and apply them to the template using gulp-inline-css without creating temporary files.
Is there any way to do this right now? Would be nice to have this feature and use it as easy as possible!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.