I am trying to use SASS in my project. I open this link and follow all command. I create a project and setup SASS. http://learn.ionicframework.com/formulas/working-with-sass/
I got this directory structure
scss
|
|—>ionic.app.scss
www
|
|->css
|
|——>ionic.app.css
In index.html file I imported ionic.app.css in style
tag. So whatever I change in ionic.app.scss file it comes ionic.app.css file and reflect in view .
If I add some element in index.html, for example I added Paragraph tag in <ion-content>
:
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Ionic Blank Starter</h1>
</ion-header-bar>
<ion-content>
<p id=“addp”>Testparagraph</p>
</ion-content>
</ion-pane>
and added this
#addp{
background-color:yellow;
}
in ionic.app.scss, it added in ionic.app.css and reflect In view.
Now what I try to do. I want to add own file “application.scss” in sass folder which should create another file “application.css” in css folder. So whatever I code in “application.scss” it come in “application.css” file and it reflect in view. I import “application.css” in index.html file.
Where I write this code so I to generate this file and watch the my “application.scss” file.
When I run ionic server and I change anything in “ionic.app.scss” file it reflect on view same time. I need to do same with “application.scss”. If I change “application.scss” it will reflect on my view .
This my gulpfile.js
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var paths = {
sass: ['./scss/**/*.scss']
};
gulp.task('default', ['sass']);
gulp.task('sass', function(done) {
gulp.src('./scss/ionic.app.scss')
.pipe(sass({
errLogToConsole: true
}))
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
});
gulp.task('install', ['git-check'], function() {
return bower.commands.install()
.on('log', function(data) {
gutil.log('bower', gutil.colors.cyan(data.id), data.message);
});
});
gulp.task('git-check', function(done) {
if (!sh.which('git')) {
console.log(
' ' + gutil.colors.red('Git is not installed.'),
'\n Git, the version control system, is required to download Ionic.',
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
);
process.exit(1);
}
done();
});