I am playing with Angular 2 using official Quick start guide.
Dev Dependencies from the package.json file allow live reload by saving html files.
I also use Gulp and live reload scss to css for decorating my stuff.
What I want is to bind Gulp's scss live reload with Angular 2's html live reload. I mean when I save changes either in a scss or in an html file, I want these changes to be done with the live reload.
For now I can make scss and html changes only separately by running either a Gulp command or the npm start command in Terminal.
My gulpfile.js code:
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('sass', function(){
return gulp.src('app/assets/scss/styles.scss')
.pipe(sass())
.pipe(gulp.dest('app/assets/css'))
});
My package.json code:
{
"name": "app",
"version": "1.0.0",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"angular2-in-memory-web-api": "0.0.20",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"browser-sync": "^2.16.0",
"concurrently": "^2.2.0",
"gulp": "^3.9.1",
"gulp-sass": "^2.3.2",
"lite-server": "^2.2.2",
"typescript": "^2.0.2",
"typings": "^1.3.2"
}
}
First, you have to tell your gulp to watch for changes in your
scssfile.In you gulpfile.js
Second, you have to start this gulp watch concurrenctly to tsc watch and the lite server.
In your package.json