Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
1)
.bowerrc set up
from www/lib
to bower_components
2)
delete www/lib folder
3)
in folder scss
// The path for our ionicons font files, relative to the built CSS in www/css
$ionicons-font-path: "../lib/fonts" !default;
// Include all of Ionic
@import "./bower_components/ionic/scss/ionic";
//gulpfile
var gulp = require('gulp');
var runSequence = require('run-sequence');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var ngAnnotate = require('gulp-ng-annotate');
var paths = {
sass: ['./scss/**/*.scss'],
vendors: [
'./bower_components/ionic/js/ionic.bundle.js',
'./bower_components/ngstorage/ngStorage.js'
],
scripts: ['./www/modules/**/*.js'],
fonts: './bower_components/ionic/fonts/**'
};
var files = {
vendors:'vendors.js',
scripts:'scripts.js'
};
var dests = {
vendors:'./www/lib/js',
scripts:'./www/lib/js',
fonts:'./www/lib/fonts'
};
gulp.task('sass', function(done) {
gulp.src('./scss/ionic.app.scss')
.pipe(sass())
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
gulp.task('vendors', function() {
return gulp.src(paths.vendors)
.pipe(concat(files.vendors))
.pipe(gulp.dest(dests.vendors));
});
gulp.task('scripts', function () {
return gulp.src(paths.scripts)
.pipe(concat(files.scripts))
.pipe(ngAnnotate())
.pipe(gulp.dest(dests.scripts));
});
gulp.task('fonts', function() {
return gulp.src(paths.fonts)
.pipe(gulp.dest(dests.fonts));
});
gulp.task('default', function(callback) {
runSequence(
['vendors','scripts' ,'fonts'],
'sass',
callback);
});
gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.scripts, ['scripts']);
});
ionic.project
{
"name": "mygulp",
"app_id": "",
"defaultBrowser": "firefox",
"gulpStartupTasks": [
"sass",
"scripts",
"watch"
],
"watchPatterns": [
"www/**/*",
"!www/lib/**/*",
"!www/css/**/*"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment