feat(build): adjust build to latest Swiip version

pull/3/head
Vladimir Lugovsky 2015-12-14 21:22:38 +03:00
parent 1935514ca8
commit de84aaa77f
8 changed files with 89 additions and 48 deletions

View File

@ -19,7 +19,7 @@ gulp.task('partials', function () {
quotes: true quotes: true
})) }))
.pipe($.angularTemplatecache('templateCacheHtml.js', { .pipe($.angularTemplatecache('templateCacheHtml.js', {
module: 'angularBestPractices', module: '123',
root: 'app' root: 'app'
})) }))
.pipe(gulp.dest(conf.paths.tmp + '/partials/')); .pipe(gulp.dest(conf.paths.tmp + '/partials/'));

View File

@ -24,7 +24,7 @@ exports.paths = {
* to inject css preprocessor deps and js files in karma * to inject css preprocessor deps and js files in karma
*/ */
exports.wiredep = { exports.wiredep = {
exclude: [/jquery/, /\/bootstrap\.js$/, /\/bootstrap-sass\/.*\.js/, /\/bootstrap\.css/], exclude: [/\/bootstrap\.js$/, /\/bootstrap-sass\/.*\.js/, /\/bootstrap\.css/],
directory: 'bower_components' directory: 'bower_components'
}; };

View File

@ -9,6 +9,12 @@ var $ = require('gulp-load-plugins')();
var wiredep = require('wiredep').stream; var wiredep = require('wiredep').stream;
var _ = require('lodash'); var _ = require('lodash');
var browserSync = require('browser-sync');
gulp.task('inject-reload', ['inject'], function() {
browserSync.reload();
});
gulp.task('inject', ['scripts', 'styles'], function () { gulp.task('inject', ['scripts', 'styles'], function () {
var injectStyles = gulp.src([ var injectStyles = gulp.src([
path.join(conf.paths.tmp, '/serve/app/**/*.css'), path.join(conf.paths.tmp, '/serve/app/**/*.css'),

View File

@ -8,10 +8,19 @@ var browserSync = require('browser-sync');
var $ = require('gulp-load-plugins')(); var $ = require('gulp-load-plugins')();
gulp.task('scripts', function () {
gulp.task('scripts-reload', function() {
return buildScripts()
.pipe(browserSync.stream());
});
gulp.task('scripts', function() {
return buildScripts();
});
function buildScripts() {
return gulp.src(path.join(conf.paths.src, '/app/**/*.js')) return gulp.src(path.join(conf.paths.src, '/app/**/*.js'))
.pipe($.eslint()) .pipe($.eslint())
.pipe($.eslint.format()) .pipe($.eslint.format())
.pipe(browserSync.reload({ stream: true }))
.pipe($.size()) .pipe($.size())
}); };

View File

@ -31,9 +31,9 @@ function browserSyncInit(baseDir, browser) {
* You just have to configure a context which will we redirected and the target url. * You just have to configure a context which will we redirected and the target url.
* Example: $http.get('/users') requests will be automatically proxified. * Example: $http.get('/users') requests will be automatically proxified.
* *
* For more details and option, https://github.com/chimurai/http-proxy-middleware/blob/v0.0.5/README.md * For more details and option, https://github.com/chimurai/http-proxy-middleware/blob/v0.9.0/README.md
*/ */
// server.middleware = proxyMiddleware('/users', {target: 'http://jsonplaceholder.typicode.com', proxyHost: 'jsonplaceholder.typicode.com'}); // server.middleware = proxyMiddleware('/users', {target: 'http://jsonplaceholder.typicode.com', changeOrigin: true});
browserSync.instance = browserSync.init({ browserSync.instance = browserSync.init({
startPath: '/', startPath: '/',
@ -53,3 +53,11 @@ gulp.task('serve', ['watch'], function () {
gulp.task('serve:dist', ['build'], function () { gulp.task('serve:dist', ['build'], function () {
browserSyncInit(conf.paths.dist); browserSyncInit(conf.paths.dist);
}); });
gulp.task('serve:e2e', ['inject'], function () {
browserSyncInit([conf.paths.tmp + '/serve', conf.paths.src], []);
});
gulp.task('serve:e2e-dist', ['build'], function () {
browserSyncInit(conf.paths.dist, []);
});

View File

@ -11,7 +11,16 @@ var $ = require('gulp-load-plugins')();
var wiredep = require('wiredep').stream; var wiredep = require('wiredep').stream;
var _ = require('lodash'); var _ = require('lodash');
gulp.task('styles', function () { gulp.task('styles-reload', ['styles'], function() {
return buildStyles()
.pipe(browserSync.stream());
});
gulp.task('styles', function() {
return buildStyles();
});
var buildStyles = function() {
var sassOptions = { var sassOptions = {
style: 'expanded' style: 'expanded'
}; };
@ -41,6 +50,5 @@ gulp.task('styles', function () {
.pipe($.sass(sassOptions)).on('error', conf.errorHandler('Sass')) .pipe($.sass(sassOptions)).on('error', conf.errorHandler('Sass'))
.pipe($.autoprefixer()).on('error', conf.errorHandler('Autoprefixer')) .pipe($.autoprefixer()).on('error', conf.errorHandler('Autoprefixer'))
.pipe($.sourcemaps.write()) .pipe($.sourcemaps.write())
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app/'))) .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app/')));
.pipe(browserSync.reload({ stream: true })); };
});

View File

@ -12,24 +12,24 @@ function isOnlyChange(event) {
gulp.task('watch', ['inject'], function () { gulp.task('watch', ['inject'], function () {
gulp.watch([path.join(conf.paths.src, '/*.html'), 'bower.json'], ['inject']); gulp.watch([path.join(conf.paths.src, '/*.html'), 'bower.json'], ['inject-reload']);
gulp.watch([ gulp.watch([
path.join(conf.paths.src, '/app/**/*.css'), path.join(conf.paths.src, '/app/**/*.css'),
path.join(conf.paths.src, '/app/**/*.scss') path.join(conf.paths.src, '/app/**/*.scss')
], function(event) { ], function(event) {
if(isOnlyChange(event)) { if(isOnlyChange(event)) {
gulp.start('styles'); gulp.start('styles-reload');
} else { } else {
gulp.start('inject'); gulp.start('inject-reload');
} }
}); });
gulp.watch(path.join(conf.paths.src, '/app/**/*.js'), function(event) { gulp.watch(path.join(conf.paths.src, '/app/**/*.js'), function(event) {
if(isOnlyChange(event)) { if(isOnlyChange(event)) {
gulp.start('scripts'); gulp.start('scripts-reload');
} else { } else {
gulp.start('inject'); gulp.start('inject-reload');
} }
}); });

View File

@ -2,38 +2,48 @@
"name": "blur_admin", "name": "blur_admin",
"version": "0.0.1", "version": "0.0.1",
"devDependencies": { "devDependencies": {
"bower": "^1.5.2", "estraverse": "~4.1.0",
"browser-sync": "^2.10.0", "gulp": "~3.9.0",
"browser-sync-spa": "^1.0.3", "gulp-autoprefixer": "~3.0.2",
"event-stream": "^3.3.1", "gulp-angular-templatecache": "~1.8.0",
"gulp": "^3.9.0", "del": "~2.0.2",
"gulp-angular-filesort": "^1.1.1", "lodash": "~3.10.1",
"gulp-angular-templatecache": "^1.7.0", "gulp-minify-css": "~1.2.1",
"gulp-autoprefixer": "^2.3.1", "gulp-filter": "~3.0.1",
"gulp-changed": "^1.3.0", "gulp-flatten": "~0.2.0",
"gulp-concat": "^2.6.0", "gulp-eslint": "~1.0.0",
"gulp-eslint": "^1.1.1", "eslint-plugin-angular": "~0.12.0",
"gulp-filter": "^3.0.1", "gulp-load-plugins": "~0.10.0",
"gulp-flatten": "^0.2.0", "gulp-size": "~2.0.0",
"gulp-imagemin": "^2.3.0", "gulp-uglify": "~1.4.1",
"gulp-inject": "^3.0.0", "gulp-useref": "~1.3.0",
"gulp-load-plugins": "^1.1.0", "gulp-util": "~3.0.6",
"gulp-minify-css": "^1.2.1", "gulp-ng-annotate": "~1.1.0",
"gulp-minify-html": "^1.0.4", "gulp-replace": "~0.5.4",
"gulp-prompt": "^0.1.2", "gulp-rename": "~1.2.2",
"gulp-rename": "^1.2.2", "gulp-rev": "~6.0.1",
"gulp-sass": "^2.0.4", "gulp-rev-replace": "~0.4.2",
"gulp-size": "^2.0.0", "gulp-minify-html": "~1.0.4",
"gulp-sourcemaps": "^1.6.0", "gulp-inject": "~3.0.0",
"gulp-strip-debug": "^1.0.2", "gulp-protractor": "~1.0.0",
"gulp-uglify": "^1.4.0", "gulp-sourcemaps": "~1.6.0",
"gulp-useref": "^3.0.3", "gulp-sass": "~2.0.4",
"gulp-zip": "^3.0.2", "gulp-angular-filesort": "~1.1.1",
"http-proxy-middleware": "^0.9.0", "main-bower-files": "~2.9.0",
"lodash": "^3.10.1", "wiredep": "~2.2.2",
"main-bower-files": "^2.9.0", "karma": "~0.13.10",
"wiredep": "^2.2.2", "karma-jasmine": "~0.3.6",
"wrench": "^1.5.8" "karma-phantomjs-launcher": "~0.2.1",
"phantomjs": "~1.9.18",
"karma-angular-filesort": "~1.0.0",
"karma-coverage": "~0.5.2",
"karma-ng-html2js-preprocessor": "~0.2.0",
"browser-sync": "~2.9.11",
"browser-sync-spa": "~1.0.3",
"http-proxy-middleware": "~0.9.0",
"chalk": "~1.1.1",
"uglify-save-license": "~0.4.1",
"wrench": "~1.5.8"
}, },
"scripts": { "scripts": {
"postinstall": "bower install" "postinstall": "bower install"