diff --git a/gulp/inject.js b/gulp/inject.js index 012a0dabc..34c577c83 100644 --- a/gulp/inject.js +++ b/gulp/inject.js @@ -11,15 +11,15 @@ var _ = require('lodash'); var browserSync = require('browser-sync'); -gulp.task('inject-reload', ['inject'], function() { +gulp.task('inject-reload', ['inject'], function () { browserSync.reload(); }); -gulp.task('inject', ['scripts', 'styles'], function () { +gulp.task('inject', ['scripts', 'styles', 'injectAuth', 'inject404'], function () { var injectStyles = gulp.src([ - path.join(conf.paths.tmp, '/serve/app/**/*.css'), + path.join(conf.paths.tmp, '/serve/app/main.css'), path.join('!' + conf.paths.tmp, '/serve/app/vendor.css') - ], { read: false }); + ], {read: false}); var injectScripts = gulp.src([ path.join(conf.paths.src, '/assets/js/**/*.js'), @@ -28,16 +28,46 @@ gulp.task('inject', ['scripts', 'styles'], function () { path.join('!' + conf.paths.src, '/app/**/*.spec.js'), path.join('!' + conf.paths.src, '/app/**/*.mock.js'), ]) - /*.pipe($.angularFilesort())*/.on('error', conf.errorHandler('AngularFilesort')); + /*.pipe($.angularFilesort())*/.on('error', conf.errorHandler('AngularFilesort')); var injectOptions = { ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve')], addRootSlash: false }; - return gulp.src(path.join(conf.paths.src, '/*.html')) + return gulp.src(path.join(conf.paths.src, '/index.html')) .pipe($.inject(injectStyles, injectOptions)) .pipe($.inject(injectScripts, injectOptions)) .pipe(wiredep(_.extend({}, conf.wiredep))) .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve'))); }); + +gulp.task('injectAuth', ['stylesAuth'], function () { + return injectAlone({ + css: [path.join('!' + conf.paths.tmp, '/serve/app/vendor.css'), path.join(conf.paths.tmp, '/serve/app/auth.css')], + paths: [path.join(conf.paths.src, '/auth.html'), path.join(conf.paths.src, '/reg.html')] + }) +}); + +gulp.task('inject404', ['styles404'], function () { + return injectAlone({ + css: [path.join('!' + conf.paths.tmp, '/serve/app/vendor.css'), path.join(conf.paths.tmp, '/serve/app/404.css')], + paths: path.join(conf.paths.src, '/404.html') + }) +}); + +var injectAlone = function (options) { + var injectStyles = gulp.src( + options.css + , {read: false}); + + var injectOptions = { + ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve')], + addRootSlash: false + }; + + return gulp.src(options.paths) + .pipe($.inject(injectStyles, injectOptions)) + .pipe(wiredep(_.extend({}, conf.wiredep))) + .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve'))); +}; \ No newline at end of file diff --git a/gulp/styles.js b/gulp/styles.js index 0e1c62bf3..93ab27dde 100644 --- a/gulp/styles.js +++ b/gulp/styles.js @@ -11,27 +11,36 @@ var $ = require('gulp-load-plugins')(); var wiredep = require('wiredep').stream; var _ = require('lodash'); -gulp.task('styles-reload', ['styles'], function() { +gulp.task('styles-reload', ['styles'], function () { return buildStyles() .pipe(browserSync.stream()); }); -gulp.task('styles', function() { +gulp.task('styles', function () { return buildStyles(); }); -var buildStyles = function() { +gulp.task('stylesAuth', function () { + return buildAloneStyles(path.join(conf.paths.src, '/sass/auth.scss')); +}); +gulp.task('styles404', function () { + return buildAloneStyles(path.join(conf.paths.src, '/sass/404.scss')); +}); + +var buildStyles = function () { var sassOptions = { style: 'expanded' }; var injectFiles = gulp.src([ path.join(conf.paths.src, '/sass/**/_*.scss'), - '!' + path.join(conf.paths.src, '/sass/theme/conf/**/*.scss') - ], { read: false }); + '!' + path.join(conf.paths.src, '/sass/theme/conf/**/*.scss'), + '!' + path.join(conf.paths.src, '/sass/404.scss'), + '!' + path.join(conf.paths.src, '/sass/auth.scss') + ], {read: false}); var injectOptions = { - transform: function(filePath) { + transform: function (filePath) { filePath = filePath.replace(conf.paths.src + '/sass/', ''); return '@import "' + filePath + '";'; }, @@ -51,3 +60,14 @@ var buildStyles = function() { .pipe($.sourcemaps.write()) .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app/'))); }; + +var buildAloneStyles = function (paths) { + var sassOptions = { + style: 'expanded' + }; + + return gulp.src([paths]) + .pipe($.sass(sassOptions)).on('error', conf.errorHandler('Sass')) + .pipe($.autoprefixer()).on('error', conf.errorHandler('Autoprefixer')) + .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app/'))); +}; diff --git a/src/404.html b/src/404.html index 33ccb63be..efdc4fc26 100644 --- a/src/404.html +++ b/src/404.html @@ -12,7 +12,11 @@ - + + + + +