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
16 changes: 12 additions & 4 deletions app/components/home.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<!-- comment -->
Home page.
<div class="container-fluid">
<h1>Home page.</h1>

<p>
<div demo-component></div>
</p>
<p>
<div demo-component></div>
</p>

<h2>Main features</h2>
<ul class="list-group">
<li class="list-group-item"><span class="label label-success"><i class="fa fa-check"></i> Boostrap</span></li>
<li class="list-group-item"><span class="label label-warning"><i class="fa fa-check"></i> Font-Awesome</span></li>
</ul>
</div>
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
<!-- inject:js -->
<!-- endinject -->
</body>
</html>
</html>
6 changes: 4 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"angular": "^1.3.12",
"angular-ui-router": "^0.2.11",
"angular-animate": "^1.3.0",
"foundation": "~5.5.1"
"bootstrap": "~3.3.5",
"foundation": "~5.5.1",
"font-awesome": "~4.3.0"
},
"devDependencies": {
"angular-mocks": "^1.2.23"
Expand All @@ -17,4 +19,4 @@
"main": "js/foundation.js"
}
}
}
}
70 changes: 66 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ var paths = {
scriptsDevServer: 'devServer/**/*.js'
};

var jsScriptsRegex = /.js$/i;
var cssStylesRegex = /.css$/i;
var lessStylesRegex = /.less$/i;
var fontsStylesRegex = /.(ttf|woff|eot|svg|woff2)$/i;

// == PIPE SEGMENTS ========

var pipes = {};
Expand Down Expand Up @@ -63,12 +68,18 @@ pipes.builtAppScriptsProd = function() {
};

pipes.builtVendorScriptsDev = function() {
return gulp.src(bowerFiles())
return gulp.src(bowerFiles({
filter: function(e) { return jsScriptsRegex.test(e); }
})
)
.pipe(gulp.dest('dist.dev/bower_components'));
};

pipes.builtVendorScriptsProd = function() {
return gulp.src(bowerFiles())
return gulp.src(bowerFiles({
filter: function(e) { return jsScriptsRegex.test(e); }
})
)
.pipe(pipes.orderedVendorScripts())
.pipe(plugins.concat('vendor.min.js'))
.pipe(plugins.uglify())
Expand Down Expand Up @@ -107,6 +118,34 @@ pipes.builtStylesDev = function() {
.pipe(gulp.dest(paths.distDev));
};

pipes.buildVendorStylesLess = function() {
return gulp.src(bowerFiles({
filter: function(e) { return lessStylesRegex.test(e); }
})
)
.pipe(plugins.less({ })
)
}

pipes.builtVendorCssStyles = function() {
return gulp.src(bowerFiles({
filter: function(e) { return cssStylesRegex.test(e); }
})
)
}

pipes.builtVendorStylesDev = function() {
return es.merge( pipes.buildVendorStylesLess(), pipes.builtVendorCssStyles() )
.pipe(gulp.dest(paths.distDev + "/styles" ) );
}

pipes.builtVendorStylesProd = function() {
return es.merge( pipes.buildVendorStylesLess(), pipes.builtVendorCssStyles() )
.pipe(plugins.concat('vendor.min.css'))
.pipe(plugins.minifyCss())
.pipe(gulp.dest(paths.distProd + "/styles"));
}

pipes.builtStylesProd = function() {
return gulp.src(paths.styles)
.pipe(plugins.sourcemaps.init())
Expand All @@ -117,6 +156,25 @@ pipes.builtStylesProd = function() {
.pipe(gulp.dest(paths.distProd));
};

pipes.processedFonts = function(base_path) {
return gulp.src(bowerFiles({
filter: function(e) { return fontsStylesRegex.test(e); }
}),
{base : 'bower_components'}
)
.pipe(plugins.rename(function (path) {
var arrayPath = path.dirname.split("/");
if (arrayPath.length > 1) {
arrayPath.splice(0,1);
new_path = "../" + arrayPath.join('/');
} else {
new_path = "./"
}
path.dirname = new_path;
}))
.pipe(gulp.dest(base_path + "/styles"));
};

pipes.processedImagesDev = function() {
return gulp.src(paths.images)
.pipe(gulp.dest(paths.distDev + '/images/'));
Expand All @@ -142,12 +200,14 @@ pipes.builtIndexDev = function() {
.pipe(pipes.orderedAppScripts());

var appStyles = pipes.builtStylesDev();
var vendorStyles = pipes.builtVendorStylesDev();

return pipes.validatedIndex()
.pipe(gulp.dest(paths.distDev)) // write first to get relative path for inject
.pipe(plugins.inject(orderedVendorScripts, {relative: true, name: 'bower'}))
.pipe(plugins.inject(orderedAppScripts, {relative: true}))
.pipe(plugins.inject(appStyles, {relative: true}))
.pipe(plugins.inject(vendorStyles, {relative: true, name: 'bower'}))
.pipe(gulp.dest(paths.distDev));
};

Expand All @@ -156,22 +216,24 @@ pipes.builtIndexProd = function() {
var vendorScripts = pipes.builtVendorScriptsProd();
var appScripts = pipes.builtAppScriptsProd();
var appStyles = pipes.builtStylesProd();
var vendorStyles = pipes.builtVendorStylesProd();

return pipes.validatedIndex()
.pipe(gulp.dest(paths.distProd)) // write first to get relative path for inject
.pipe(plugins.inject(vendorScripts, {relative: true, name: 'bower'}))
.pipe(plugins.inject(appScripts, {relative: true}))
.pipe(plugins.inject(appStyles, {relative: true}))
.pipe(plugins.inject(vendorStyles, {relative: true, name: 'bower'}))
.pipe(plugins.htmlmin({collapseWhitespace: true, removeComments: true}))
.pipe(gulp.dest(paths.distProd));
};

pipes.builtAppDev = function() {
return es.merge(pipes.builtIndexDev(), pipes.builtPartialsDev(), pipes.processedImagesDev());
return es.merge(pipes.builtIndexDev(), pipes.builtPartialsDev(), pipes.processedFonts(paths.distDev), pipes.processedImagesDev());
};

pipes.builtAppProd = function() {
return es.merge(pipes.builtIndexProd(), pipes.processedImagesProd());
return es.merge(pipes.builtIndexProd(), pipes.processedFonts(paths.distProd), pipes.processedImagesProd());
};

// == TASKS ========
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,27 @@
"express": "^4.7.2",
"gulp": "^3.8.10",
"gulp-angular-filesort": "^1.0.4",
"gulp-bower-assets": "0.0.3",
"gulp-concat": "^2.4.3",
"gulp-htmlhint": "0.0.9",
"gulp-htmlmin": "^1.0.0",
"gulp-inject": "^1.1.1",
"gulp-jshint": "^1.9.2",
"gulp-less": "^3.0.3",
"gulp-livereload": "^3.7.0",
"gulp-load-plugins": "^0.8.0",
"gulp-minify-css": "^0.4.5",
"gulp-ng-html2js": "^0.1.8",
"gulp-nodemon": "^1.0.5",
"gulp-order": "^1.1.1",
"gulp-print": "^1.1.0",
"gulp-rename": "^1.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^1.3.2",
"gulp-sourcemaps": "^1.3.0",
"gulp-uglify": "^1.1.0",
"jshint-stylish": "^1.0.0",
"karma": "^0.10",
"karma-junit-reporter": "^0.2.2",
"karma": "^0.13.3",
"karma-junit-reporter": "^0.3.3",
"main-bower-files": "^2.5.0",
"method-override": "^2.1.2",
"protractor": "^1.1.1",
Expand All @@ -40,5 +42,6 @@
"postinstall": "bower install",
"prestart": "npm install",
"start": "node server.js"
}
},
"dependencies": {}
}