Using an ionic blank template with its default gulpfile and running:
ionic setup sass
I can build the application's Sass, but I wanted to add Compass. So using Gulp I added the below code to my gulpfile based on gulp-compass examples:
gulp.task( 'compass', function( done ) {
gulp.src( './scss/ionic.app.scss' )
.pipe( compass( {
config_file: 'config.rb',
css: 'www/css',
sass: 'scss'
} ) )
.pipe( minifyCss( {
keepSpecialComments: 0
} ) )
.pipe( rename( { extname: '.min.css' } ) )
.pipe( gulp.dest( './www/css/' ) )
.on( 'end', done );
} );
Now it appears to work when I build using:
ionic compass
But, when I run:
ionic serve
and it runs through building out any changes in the Sass I kept getting an error:
Task 'sass' is not in your gulpfile
Since I had removed the 'sass' task and replaced it with my 'compass' task, and replaced all references with compass why is it even aware of a 'sass' task anymore? There were only three references in the default gulpfile, but the only way to get this to work was to rename my 'compass' task to be 'sass', but run the compass pipe inside it instead of the sass pipe.
// renamed to sass from compass to remove build error
gulp.task( 'sass', function( done ) {
gulp.src( './scss/ionic.app.scss' )
.pipe( compass( {
config_file: 'config.rb',
css: 'www/css',
sass: 'scss'
} ) )
.pipe( minifyCss( {
keepSpecialComments: 0
} ) )
.pipe( rename( { extname: '.min.css' } ) )
.pipe( gulp.dest( './www/css/' ) )
.on( 'end', done );
} );