I am creating a project in CodeIgniter 3 with HMVC, where the assets will be inside the module folders. I created a gulpfile, I installed all modules by npm, but gulp-sass, to compile the SCSS files is not working.
The code is as follows:
var sass = require('gulp-sass');
gulp.task('sass', function () {
return gulp.src([config.paths.sass.srcAll + '/**/[^_]*.scss', '!application/modules/comum/assets/plugins/**/*.scss'])
.pipe(sass({
paths: ['.',
'./node_modules',
'./bower_components',
'application/modules/comum/assets/scss'
]
})
.on("error", plugins.notify.onError(function (error) {
return "Error: " + error.message + '\n' + error.line + ':' + error.index
})))
.pipe(plugins.cssmin({
compatibility: 'ie9'
}))
.pipe(plugins.rename(function (path) {
path.dirname += '/../css';
}))
.pipe(gulp.dest(config.paths.less.srcAll))
.pipe(plugins.debug())
.pipe(plugins.notify({
message: 'Compiled SCSS (' + plugins.moment().format('MMM Do h:mm:ss A') + ')',
onLast: true
}));
});
When I save the .SCSS file I get the following error:
[09:38:45] 'sass' errored after 2.43 ms
[09:38:45] TypeError: sass is not a function
at Gulp.<anonymous> (C:\wamp64\www\fast2pay\painel\gulpfile.js:164:9)
at module.exports (C:\wamp64\www\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\wamp64\www\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\wamp64\www\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\wamp64\www\node_modules\orchestrator\index.js:134:8)
at Gulp.<anonymous> (C:\wamp64\www\node_modules\gulp\index.js:36:18)
at Gaze.<anonymous> (C:\wamp64\www\node_modules\glob-watcher\index.js:18:14)
at Gaze.emit (events.js:160:13)
at Gaze.emit (C:\wamp64\www\node_modules\gaze\lib\gaze.js:129:32)
at C:\wamp64\www\node_modules\gaze\lib\gaze.js:415:16
Can anyone help me?