Understrap: Gulp Watch not compiling theme.min.css

Created on 1 Aug 2017  路  5Comments  路  Source: understrap/understrap

When I try to run gulp watch upon saving the file the changes aren't reflected in both theme.css or theme.min.css but I do see this on the console:

```[12:18:12] Using gulpfile /var/www/wp-content/themes/promz/gulpfile.js
[12:18:12] Starting 'watch'...
[12:18:12] Finished 'watch' after 11 ms
[12:18:21] Starting 'styles'...
[12:18:21] Starting 'sass'...
[12:18:22] Finished 'sass' after 463 ms
[12:18:22] Starting 'minify-css'...
[12:18:22] Finished 'minify-css' after 264 ms
[12:18:22] Finished 'styles' after 732 ms

When I try to run `gulp scss-for-dev` I see changes on theme.css but not on theme.min.css with no errors.

But when I try to run ` gulp scss-for-prod` it gives the following error

[12:12:58] Using gulpfile /var/www/wp-content/wp-content/themes/promz/gulpfile.js
[12:12:58] Starting 'scss-for-prod'...
[12:12:58] 'scss-for-prod' errored after 11 ms
[12:12:58] ReferenceError: minify is not defined
at Gulp. (/var/www/wp-content/wp-content/themes/promz/gulpfile.js:69:15)
at module.exports (/var/www/wp-content/wp-content/themes/promz/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/var/www/wp-content/wp-content/themes/promz/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/var/www/wp-content/wp-content/themes/promz/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/var/www/wp-content/wp-content/themes/promz/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
at /home/hetportaal/lib/node_modules/gulp/bin/gulp.js:129:20
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
```

Most helpful comment

The easiest fix is to change line 69 in the gulpfile.js from:
.pipe(minify-css())
to
.pipe(cssnano())

All 5 comments

I'm struggeling with this issue to.
I've downloaded this theme for the first time today and I'm totally new to gulp. This project helped me to get into in.
But what I miss, or can't find.. Is a way to export everything production ready. So run the scss-for-prod (which is broken), maybe some other tasks, copy everything to dist folder, all with one command.
When I tried to make that myself, I ran in the error as fahaddsheikh

I have the exact same issue. I nobody else using the scss-for-prod then?

Seems like there is something missing with minify-css. I found a solution:

On package.json should define a new requirement like:

var minifycss = require('gulp-cssnano');

Later, replace minify-css by minifycss over all package.json file

The easiest fix is to change line 69 in the gulpfile.js from:
.pipe(minify-css())
to
.pipe(cssnano())

Closing this issue because @joshua-stewart provided valuable feedback and because the gulpfile.js has multiple revisions since. @Marcvz and @fahaddsheikh and @Parcye comment if you are still experiencing issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

virtualimage picture virtualimage  路  3Comments

holger1411 picture holger1411  路  5Comments

shansmith01 picture shansmith01  路  5Comments

Design-Depot picture Design-Depot  路  4Comments

swinggraphics picture swinggraphics  路  4Comments