Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('healthyGulpAngularApp', ['ui.router'])
angular.module('healthyGulpAngularApp', ['ui.router', 'healthyGulpAngularAppComponents'])

.config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
Expand All @@ -12,4 +12,4 @@ angular.module('healthyGulpAngularApp', ['ui.router'])
templateUrl: 'components/home.html'
});

}]);
}]);
10 changes: 7 additions & 3 deletions app/components/demoComponent/demoComponentDirective.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
angular.module('healthyGulpAngularApp')
try {
module = angular.module('healthyGulpAngularAppComponents');
} catch (e) {
module = angular.module('healthyGulpAngularAppComponents', []);
}

.directive('demoComponent', [function() {
module.directive('demoComponent', [function() {
return {
restrict: 'A',
templateUrl: 'components/demoComponent/demoComponent.html'
};
}]);
}]);
1 change: 1 addition & 0 deletions app/components/demoComponent/demoCsComponent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>This is a CoffeScript demo component.</h1>
9 changes: 9 additions & 0 deletions app/components/demoComponent/demoCsComponentDirective.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
try
module = angular.module 'healthyGulpAngularAppComponents'
catch e
module = angular.module 'healthyGulpAngularAppComponents', []

module.directive 'demoCsComponent', [ () ->
restrict: 'A',
templateUrl: 'components/demoComponent/demoCsComponent.html'
]
1 change: 1 addition & 0 deletions app/components/demoComponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

5 changes: 4 additions & 1 deletion app/components/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@

<p>
<div demo-component></div>
</p>
</p>
<p>
<div demo-cs-component></div>
</p>
31 changes: 28 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var Q = require('q');
// == PATH STRINGS ========

var paths = {
coffee_scripts: 'app/**/*.coffee',
scripts: 'app/**/*.js',
styles: ['./app/**/*.css', './app/**/*.scss'],
images: './images/**/*',
Expand Down Expand Up @@ -38,22 +39,34 @@ pipes.minifiedFileName = function() {
});
};

pipes.compiledAppCS = function() {
return gulp.src(paths.coffee_scripts)
.pipe(plugins.sourcemaps.init())
.pipe(plugins.coffee({bare: true})
.on('error', plugins.util.log))
.pipe(plugins.sourcemaps.write());
};

pipes.validatedAppScripts = function() {
return gulp.src(paths.scripts)
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'));
};

pipes.builtAppScriptsDev = function() {
return pipes.validatedAppScripts()
var compiledAppCS = pipes.compiledAppCS();
var validatedAppScripts = pipes.validatedAppScripts();

return es.merge(compiledAppCS, validatedAppScripts)
.pipe(gulp.dest(paths.distDev));
};

pipes.builtAppScriptsProd = function() {
var scriptedPartials = pipes.scriptedPartials();
var compiledAppCS = pipes.compiledAppCS();
var validatedAppScripts = pipes.validatedAppScripts();

return es.merge(scriptedPartials, validatedAppScripts)
return es.merge(scriptedPartials, validatedAppScripts, compiledAppCS)
.pipe(pipes.orderedAppScripts())
.pipe(plugins.sourcemaps.init())
.pipe(plugins.concat('app.min.js'))
Expand Down Expand Up @@ -97,7 +110,7 @@ pipes.scriptedPartials = function() {
.pipe(plugins.htmlhint.failReporter())
.pipe(plugins.htmlmin({collapseWhitespace: true, removeComments: true}))
.pipe(plugins.ngHtml2js({
moduleName: "healthyGulpAngularApp"
moduleName: "healthyGulpAngularAppComponents"
}));
};

Expand Down Expand Up @@ -267,6 +280,12 @@ gulp.task('watch-dev', ['clean-build-app-dev', 'validate-devserver-scripts'], fu
.pipe(plugins.livereload());
});

// watch app coffee scripts
gulp.watch(paths.coffee_scripts, function() {
return pipes.builtAppScriptsDev()
.pipe(plugins.livereload());
});

// watch app scripts
gulp.watch(paths.scripts, function() {
return pipes.builtAppScriptsDev()
Expand Down Expand Up @@ -306,6 +325,12 @@ gulp.task('watch-prod', ['clean-build-app-prod', 'validate-devserver-scripts'],
.pipe(plugins.livereload());
});

// watch app coffee scripts
gulp.watch(paths.coffee_scripts, function() {
return pipes.builtAppScriptsProd()
.pipe(plugins.livereload());
});

// watch app scripts
gulp.watch(paths.scripts, function() {
return pipes.builtAppScriptsProd()
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"devDependencies": {
"body-parser": "^1.5.2",
"bower": "^1.3.1",
"coffee-script": "~1.9",
"del": "^1.1.1",
"event-stream": "^3.2.2",
"express": "^4.7.2",
"gulp": "^3.8.10",
"gulp-angular-filesort": "^1.0.4",
"gulp-coffee": "~2.3",
"gulp-concat": "^2.4.3",
"gulp-htmlhint": "0.0.9",
"gulp-htmlmin": "^1.0.0",
Expand All @@ -27,6 +29,7 @@
"gulp-sass": "^1.3.2",
"gulp-sourcemaps": "^1.3.0",
"gulp-uglify": "^1.1.0",
"gulp-util": "^3.0.6",
"jshint-stylish": "^1.0.0",
"karma": "^0.10",
"karma-junit-reporter": "^0.2.2",
Expand Down