creativetimofficial / ct-material-dashboard-pro

Material Dashboard Pro - Premium Bootstrap 5 Admin
https://demos.creative-tim.com/material-dashboard-pro/pages/dashboards/analytics
116 stars 28 forks source link

Can't add Minify to Gulpfile.js - for minifying in watch mode eg. assets/js/dashboard-material.js #267

Closed edwardtilley closed 4 years ago

edwardtilley commented 4 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Expected Behavior

Am expecting the following gulpfile.js additions to permit gulp to minify - per instructinos at http://zetcode.com/gulp/minify/

var minify = require("gulp-minify"); var Paths = { JS_SOURCES: './assets/js/material-dashboard.js' }; gulp.task('minify', () => { return gulp.src(Paths.JS_SOURCES, { allowEmpty: true }) .pipe(minify({noSource: true})) .pipe(gulp.dest('./assets/js/')) });

Current Behavior

gulp minify internal/modules/cjs/loader.js:796 throw err; ^ Error: Cannot find module 'gulp-minify' Require stack:

  • F:\Users\etilley\Projects\MaterialPRO\material-dashboard-pro-html-v2.1.0\gulpfile.js
  • C:\Users\etilley\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js
  • C:\Users\etilley\AppData\Roaming\npm\node_modules\gulp-cli\index.js
  • C:\Users\etilley\AppData\Roaming\npm\node_modules\gulp-cli\bin\gulp.js ←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:686:27)←[39m ←[90m at Module.require (internal/modules/cjs/loader.js:848:19)←[39m ←[90m at require (internal/modules/cjs/helpers.js:74:18)←[39m at Object. (F:\Users\etilley\Projects\MaterialPRO\material-dashboard-pro-html-v2.1.0\gulpfile.js:7:14) ←[90m at Module._compile (internal/modules/cjs/loader.js:955:30)←[39m ←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)←[39m ←[90m at Module.load (internal/modules/cjs/loader.js:811:32)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:723:14)←[39m ←[90m at Module.require (internal/modules/cjs/loader.js:848:19)←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [ ←[32m'F:\Users\etilley\Projects\MaterialPRO\material-dashboard-pro-html-v2.1.0\gulpfile.js'←[39m, ←[32m'C:\Users\etilley\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js'←[39m, ←[32m'C:\Users\etilley\AppData\Roaming\npm\node_modules\gulp-cli\index.js'←[39m, ←[32m'C:\Users\etilley\AppData\Roaming\npm\node_modules\gulp-cli\bin\gulp.js'←[39m ] }

Context

https://stackoverflow.com/questions/21406738/cant-get-gulp-to-run-cannot-find-module-gulp-util - these instructions suggest that I remove node_modules with the following commands but this seems too drastic.

rm -rf node_modules/ npm install

Failure Logs

Please include any relevant log snippets or files here.

groovemen commented 4 years ago

Hello @edwardtilley,

Thank you for using our products, we have responded to your other issues that have similar behavior. You can find your answer right there. We will take into consideration and if there will be other users that need the same behavior we will implement into the product, in the next update.

All the best, Stefan