Skip to content

Commit

Permalink
Fix issue #848 (#853)
Browse files Browse the repository at this point in the history
* Fix issue #848

* Process the css in the 'styles' task
  • Loading branch information
Wenchen Li authored and addyosmani committed Jun 2, 2016
1 parent 722095f commit 20eb478
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ <h1 class="mdl-mega-footer--heading">FAQ</h1>
</div>

<script src="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js"></script>
<!-- build:js(app/) ../../scripts/main.min.js -->
<!-- build:js scripts/main.min.js -->
<script src="scripts/main.js"></script>
<!-- endbuild -->

Expand Down
25 changes: 12 additions & 13 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ gulp.task('styles', () => {
.pipe($.sass({
precision: 10
}).on('error', $.sass.logError))
// Remove any unused CSS
.pipe($.if('*.css', $.uncss({
html: [
'app/index.html'
],
// CSS Selectors for UnCSS to ignore
ignore: []
})))
.pipe($.autoprefixer(AUTOPREFIXER_BROWSERS))
.pipe(gulp.dest('.tmp/styles'))
// Concatenate and minify styles
Expand Down Expand Up @@ -128,19 +136,10 @@ gulp.task('scripts', () =>
// Scan your HTML for assets & optimize them
gulp.task('html', () => {
return gulp.src('app/**/*.html')
.pipe($.useref({searchPath: '{.tmp,app}'}))
// Remove any unused CSS
.pipe($.if('*.css', $.uncss({
html: [
'app/index.html'
],
// CSS Selectors for UnCSS to ignore
ignore: []
})))

// Concatenate and minify styles
// In case you are still using useref build blocks
.pipe($.if('*.css', $.cssnano()))
.pipe($.useref({
searchPath: '{.tmp,app}',
noAssets: true
}))

// Minify any HTML
.pipe($.if('*.html', $.htmlmin({
Expand Down

0 comments on commit 20eb478

Please sign in to comment.