jonkemp / jonkemp/gulp-inline-css

Use files from stream instead of parsing the document

Open
#21 0 comments 0 reactions 0 assignees View on GitHub
question
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.