Skip to content

Commit

Permalink
Gulp less compile task - pending to get it working with watch
Browse files Browse the repository at this point in the history
  • Loading branch information
eamador committed Apr 18, 2017
1 parent 63e0ee7 commit 0c29232
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
21 changes: 21 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ var builder = new Builder('', 'src/systemjs.config.js');
var sourcemaps = require('gulp-sourcemaps');
var typescript = require('gulp-typescript');
var uglify = require('gulp-uglifyjs');
var less = require('gulp-less');
var watchLess = require('gulp-watch-less');
var cleanCSS = require('gulp-clean-css');
var bundleHash = new Date().getTime();
var mainBundleName = bundleHash + '.main.bundle.js';
var vendorBundleName = bundleHash + '.vendor.bundle.js';
Expand Down Expand Up @@ -146,6 +149,24 @@ gulp.task('clean:ts', function () {
.pipe(clean());
});

gulp.task('clean:css', function () {
return gulp.src(['./public/css/styles.css'], {read: false})
.pipe(clean());
});

gulp.task('less', ['clean:css', 'less:c']);

gulp.task('less:c', function () {
return gulp.src(`src/css/styles.less`)
// .pipe(watchLess('src/css/styles.less'))
.pipe(less().on('error', function (err) {
console.log(err);
this.emit("end");
}))
// .pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest(`src/css/`));
});

// This is main task for production use
gulp.task('dist_uncompressed', function (done) {
runSequence('compile_ts', 'copy:app', 'copy:assets', 'copy:dependencies', function () {
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"start": "tsc && concurrently \"npm run less\" \"npm run tsc:w\" \"npm run lite\"",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"lint": "tslint ./src/**/*.ts -t verbose",
"dist": "gulp dist",
"less": "gulp less",
"publish": "gulp dist && s3_website push"
},
"private": true,
Expand All @@ -29,11 +30,14 @@
"core-js": "^2.4.1",
"es6-promise": "^4.1.0",
"gulp-clean": "^0.3.2",
"gulp-clean-css": "^3.0.4",
"gulp-html-replace": "^1.6.2",
"gulp-less": "^3.3.0",
"gulp-rename": "^1.2.2",
"gulp-shell": "^0.6.3",
"gulp-watch-less": "^1.0.1",
"install": "^0.8.7",
"mapbox-gl": "^0.34.0",
"mapbox-gl": "^0.35.1",
"pump": "^1.0.2",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.1.0",
Expand Down

0 comments on commit 0c29232

Please sign in to comment.