mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-07 01:54:27 +00:00
gulp tasks reorg
This commit is contained in:
266
gulpfile.js
266
gulpfile.js
@@ -1,260 +1,18 @@
|
||||
// TODO: bower, tmp-assets
|
||||
// TODO: asset, www/assets
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp');
|
||||
var rename = require('gulp-rename');
|
||||
var clean = require('gulp-clean');
|
||||
var concat = require('gulp-concat');
|
||||
var uglify = require('gulp-uglify');
|
||||
var qunit = require('gulp-qunit');
|
||||
var mochaPhantomjs = require('gulp-mocha-phantomjs');
|
||||
var cssmin = require('gulp-cssmin');
|
||||
var install = require('gulp-install');
|
||||
var sass = require('gulp-sass');
|
||||
var del = require('del');
|
||||
var wrench = require('wrench');
|
||||
|
||||
var paths = {
|
||||
vendors: 'tmp-assets/',
|
||||
dist: 'www/assets/'
|
||||
};
|
||||
|
||||
|
||||
gulp.task('mocha_phantomjs', function () {
|
||||
return gulp.src('www/scripts/tests/*.html')
|
||||
.pipe(mochaPhantomjs({
|
||||
'reporter': 'dot',
|
||||
'setting': [
|
||||
'loadImages=false'
|
||||
]
|
||||
}));
|
||||
});
|
||||
|
||||
gulp.task('qunit', function () {
|
||||
return gulp.src('www/include/js/tests/*.html')
|
||||
.pipe(qunit());
|
||||
});
|
||||
|
||||
gulp.task('clean:vendor', function(done){
|
||||
return del([paths.dist + '/**/*'], done);
|
||||
/**
|
||||
* This will load all js or coffee files in the gulp directory
|
||||
* in order to load all gulp tasks
|
||||
*/
|
||||
wrench.readdirSyncRecursive('./resources/gulp').filter(function(file) {
|
||||
return (/\.(js)$/i).test(file);
|
||||
}).map(function(file) {
|
||||
require('./resources/gulp/' + file);
|
||||
});
|
||||
|
||||
|
||||
var lib = require('bower-files')({
|
||||
overrides: {
|
||||
'backbone-amd': {
|
||||
main: ['./backbone.js', 'LICENSE']
|
||||
},
|
||||
'font-awesome': {
|
||||
main: ['css/*', 'font/*']
|
||||
},
|
||||
'humane-js': {
|
||||
main: ['humane.js', 'themes/libnotify.css']
|
||||
},
|
||||
'jquery': {
|
||||
main: 'jquery.js'
|
||||
},
|
||||
'jquery.treeview': {
|
||||
main: ['images/*',
|
||||
'jquery.treeview*']
|
||||
},
|
||||
'jquery-mobile-bower': {
|
||||
main: ['css/jquery.mobile-1.3.2.css', 'js/jquery.mobile-1.3.2.js']
|
||||
},
|
||||
'json2': {
|
||||
main: ['json2.js']
|
||||
},
|
||||
'modernizr': {
|
||||
main: 'modernizr.js'
|
||||
},
|
||||
'tinymce': {
|
||||
main: ['plugins/**',
|
||||
'skins/**',
|
||||
'themes/**',
|
||||
'*.js',
|
||||
'changelog.txt',
|
||||
'license.txt']
|
||||
},
|
||||
'underscore-amd': {
|
||||
main:
|
||||
'underscore.js'
|
||||
},
|
||||
zxcvbn: {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'jquery-galleria': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'bootstrap-multiselect': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'fancytree': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'jquery-ui': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'swfobject': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'blueimp-load-image': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'jquery-file-upload': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'i18next': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
}
|
||||
}
|
||||
});
|
||||
gulp.task('default', ['install-assets']);
|
||||
|
||||
gulp.task('copy-dev-vendors', function(){
|
||||
// @TODO copy:
|
||||
// chai,js-fixtures, mocha sinon-chai, sinonjs, squire, qunit
|
||||
gulp.src(paths.vendors + 'chai/chai.js')
|
||||
.pipe(gulp.dest( paths.dist + 'chai/'));
|
||||
|
||||
gulp.src(paths.vendors + 'js-fixtures/fixtures.js')
|
||||
.pipe(gulp.dest( paths.dist + 'js-fixtures/'));
|
||||
|
||||
gulp.src([paths.vendors + 'mocha/mocha.js', paths.vendors + 'mocha/mocha.css'])
|
||||
.pipe(gulp.dest( paths.dist + 'mocha/'));
|
||||
|
||||
gulp.src(paths.vendors + 'sinon-chai/lib/sinon-chai.js')
|
||||
.pipe(gulp.dest( paths.dist + 'sinon-chai/'));
|
||||
|
||||
gulp.src(paths.vendors + 'sinonjs/sinon.js')
|
||||
.pipe(gulp.dest( paths.dist + 'sinonjs/'));
|
||||
|
||||
gulp.src(paths.vendors + 'squire/src/Squire.js')
|
||||
.pipe(gulp.dest( paths.dist + 'squire/'));
|
||||
|
||||
gulp.src([paths.vendors + 'qunit/qunit/qunit.js', paths.vendors + 'qunit/qunit/qunit.css'])
|
||||
.pipe(gulp.dest( paths.dist + 'qunit/'));
|
||||
|
||||
gulp.src(paths.vendors + 'qunit/addons/phantomjs/*')
|
||||
.pipe(gulp.dest( paths.dist + 'qunit/addons/phantomjs'));
|
||||
});
|
||||
|
||||
gulp.task('copy-vendor-via-bower', function () {
|
||||
var vendorConfig = {
|
||||
'jquery-mobile-bower/css': {
|
||||
dirname: 'jquery-mobile'
|
||||
},
|
||||
'jquery-mobile-bower/js': {
|
||||
dirname: 'jquery-mobile'
|
||||
}
|
||||
};
|
||||
|
||||
return gulp.src(lib.ext().files, { base: paths.vendors })
|
||||
.pipe(rename(function (path) {
|
||||
if( vendorConfig[path.dirname] !== undefined ) {
|
||||
// console.log('reading path', path)
|
||||
var cuConf = vendorConfig[path.dirname];
|
||||
path.dirname = cuConf.dirname;
|
||||
}
|
||||
return path;
|
||||
}))
|
||||
.pipe(gulp.dest(paths.dist));
|
||||
});
|
||||
|
||||
// copy additionnal assets from vendors to match old legacy assets:
|
||||
gulp.task('copy-vendors', ['copy-vendor-via-bower'],function () {
|
||||
gulp.src([paths.vendors + 'fancytree/dist/skin-win8/**/*']) //, paths.vendors + 'fancytree/dist/jquery.fancytree-all.min
|
||||
.pipe(gulp.dest( paths.dist + 'fancytree/dist/skin-win8'))
|
||||
|
||||
gulp.src(paths.vendors + 'jquery-ui/ui/jquery-ui.js')
|
||||
.pipe(gulp.dest( paths.dist + 'jquery.ui/'));
|
||||
|
||||
gulp.src(paths.vendors + 'jquery-ui/themes/base/*.css')
|
||||
.pipe(gulp.dest( paths.dist + 'jquery.ui/'));
|
||||
|
||||
gulp.src(paths.vendors + 'jquery-ui/ui/i18n/*')
|
||||
.pipe(gulp.dest( paths.dist + 'jquery.ui/i18n'));
|
||||
|
||||
gulp.src(paths.vendors + 'jquery-ui/themes/base/images/*')
|
||||
.pipe(gulp.dest( paths.dist + 'jquery.ui/images'));
|
||||
|
||||
gulp.src(paths.vendors + 'swfobject/swfobject/swfobject.js')
|
||||
.pipe(gulp.dest( paths.dist + 'swfobject'));
|
||||
|
||||
|
||||
gulp.src([paths.vendors + 'jquery-file-upload/js/*', paths.vendors + 'jquery-file-upload/js/vendor/*', paths.vendors + 'jquery-file-upload/css/*'])
|
||||
.pipe(gulp.dest( paths.dist + 'jquery-file-upload'));
|
||||
|
||||
gulp.src(paths.vendors + 'blueimp-load-image/js/*.js')
|
||||
.pipe(gulp.dest( paths.dist + 'blueimp-load-image'));
|
||||
|
||||
gulp.src(paths.vendors + 'i18next/release/i18next.amd-1.6.3.js')
|
||||
.pipe(gulp.dest( paths.dist + 'i18next'));
|
||||
|
||||
gulp.src(paths.vendors + 'bootstrap-multiselect/dist/**/*')
|
||||
.pipe(gulp.dest( paths.dist + 'bootstrap-multiselect'));
|
||||
|
||||
gulp.src([paths.vendors + 'jquery-galleria/src/galleria.js', paths.vendors + 'jquery-galleria/src/themes/classic/*'])
|
||||
.pipe(gulp.dest( paths.dist + 'jquery-galleria'));
|
||||
|
||||
gulp.src(paths.vendors + 'zxcvbn/dist/zxcvbn.js')
|
||||
.pipe(gulp.dest( paths.dist + 'zxcvbn'));
|
||||
|
||||
gulp.start('copy-dev-vendors');
|
||||
});
|
||||
|
||||
gulp.task('bootstrap-js', function () {
|
||||
var btSource = [
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-transition.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-alert.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-modal.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-dropdown.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-scrollspy.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-tab.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-tooltip.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-popover.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-button.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-collapse.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-carousel.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-typeahead.js',
|
||||
paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-affix.js'];
|
||||
|
||||
gulp.src(btSource)
|
||||
.pipe(concat('bootstrap.js'))
|
||||
.pipe(gulp.dest( paths.dist + 'bootstrap/js'))
|
||||
.pipe(uglify())
|
||||
.pipe(rename({ extname: '.min.js' }))
|
||||
.pipe(gulp.dest( paths.dist + 'bootstrap/js'))
|
||||
});
|
||||
gulp.task('bootstrap-assets', function () {
|
||||
gulp.src([paths.vendors + 'bootstrap-sass/vendor/assets/images/**/*'])
|
||||
.pipe(gulp.dest( paths.dist + 'bootstrap/img'));
|
||||
|
||||
});
|
||||
gulp.task('build-bootstrap', ['bootstrap-assets', 'bootstrap-js'], function () {
|
||||
gulp.src(paths.vendors + 'bootstrap-sass/vendor/assets/stylesheets/bootstrap.scss')
|
||||
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
||||
.pipe(gulp.dest( paths.dist + 'bootstrap/css/'))
|
||||
.pipe(cssmin())
|
||||
.pipe(rename({ suffix: '.min' }))
|
||||
.pipe(gulp.dest( paths.dist + 'bootstrap/css'));
|
||||
gulp.src(paths.vendors + 'bootstrap-sass/vendor/assets/stylesheets/bootstrap-responsive.scss')
|
||||
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
||||
.pipe(gulp.dest( paths.dist + 'bootstrap/css/'))
|
||||
.pipe(cssmin())
|
||||
.pipe(rename({ suffix: '.min' }))
|
||||
.pipe(gulp.dest( paths.dist + 'bootstrap/css'));
|
||||
});
|
||||
|
||||
gulp.task('install-dependencies', function(done){
|
||||
return gulp.src(['./bower.json'])
|
||||
.pipe(install());
|
||||
});
|
||||
|
||||
gulp.task('copy-dependencies', ['install-dependencies'], function(){
|
||||
gulp.start('copy-vendors');
|
||||
gulp.start('build-bootstrap');
|
||||
});
|
||||
|
||||
gulp.task('install-assets', ['clean:vendor'], function(){
|
||||
gulp.start('copy-dependencies');
|
||||
});
|
||||
|
||||
// js fixtures should be present (./bin/developer phraseanet:generate-js-fixtures)
|
||||
gulp.task('test', ['qunit','mocha_phantomjs']);
|
||||
|
13
package.json
13
package.json
@@ -5,15 +5,6 @@
|
||||
"bower": "~1.3",
|
||||
"bower-files": "^3.11.3",
|
||||
"del": "^2.0.2",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-bower-postinst": "~0.2.0",
|
||||
"grunt-bower-task": "~0.4.0",
|
||||
"grunt-cli": "latest",
|
||||
"grunt-contrib-clean": "^0.6.0",
|
||||
"grunt-contrib-copy": "^0.8.2",
|
||||
"grunt-contrib-qunit": "^0.7.0",
|
||||
"grunt-mocha-phantomjs": "~0.3.0",
|
||||
"grunt-shell": "~0.6",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-cssmin": "^0.1.7",
|
||||
"gulp-install": "^0.6.0",
|
||||
@@ -21,10 +12,12 @@
|
||||
"gulp-qunit": "^1.2.1",
|
||||
"gulp-sass": "^2.1.0",
|
||||
"gulp-uglify": "^1.4.2",
|
||||
"gulp-util": "^3.0.7",
|
||||
"jake": "latest",
|
||||
"mocha-phantomjs": ">=2.0 <3.0",
|
||||
"recess": ">=1.1.0 <1.1.7",
|
||||
"tmp": "0.0.23",
|
||||
"uglify-js": "latest"
|
||||
"uglify-js": "latest",
|
||||
"wrench": "^1.5.8"
|
||||
}
|
||||
}
|
||||
|
16
resources/gulp/config.js
Normal file
16
resources/gulp/config.js
Normal file
@@ -0,0 +1,16 @@
|
||||
var gutil = require("gulp-util");
|
||||
var configPaths = {
|
||||
vendors: 'tmp-assets/',
|
||||
dist: 'www/assets/'
|
||||
};
|
||||
|
||||
exports.paths = configPaths;
|
||||
|
||||
exports.errorHandler = function(title) {
|
||||
'use strict';
|
||||
|
||||
return function(err) {
|
||||
gutil.log(gutil.colors.red('[' + title + ']'), err.toString());
|
||||
this.emit('end');
|
||||
};
|
||||
};
|
237
resources/gulp/install.js
Normal file
237
resources/gulp/install.js
Normal file
@@ -0,0 +1,237 @@
|
||||
|
||||
|
||||
|
||||
// TODO: bower, tmp-assets
|
||||
// TODO: asset, www/assets
|
||||
var gulp = require('gulp');
|
||||
var rename = require('gulp-rename');
|
||||
var clean = require('gulp-clean');
|
||||
var concat = require('gulp-concat');
|
||||
var uglify = require('gulp-uglify');
|
||||
var cssmin = require('gulp-cssmin');
|
||||
var install = require('gulp-install');
|
||||
var sass = require('gulp-sass');
|
||||
var del = require('del');
|
||||
var config = require('./config.js');
|
||||
|
||||
gulp.task('clean:vendors', function(done){
|
||||
return del([config.paths.dist + '/**/*'], done);
|
||||
});
|
||||
|
||||
|
||||
var lib = require('bower-files')({
|
||||
overrides: {
|
||||
'backbone-amd': {
|
||||
main: ['./backbone.js', 'LICENSE']
|
||||
},
|
||||
'font-awesome': {
|
||||
main: ['css/*', 'font/*']
|
||||
},
|
||||
'humane-js': {
|
||||
main: ['humane.js', 'themes/libnotify.css']
|
||||
},
|
||||
'jquery': {
|
||||
main: 'jquery.js'
|
||||
},
|
||||
'jquery.treeview': {
|
||||
main: ['images/*',
|
||||
'jquery.treeview*']
|
||||
},
|
||||
'jquery-mobile-bower': {
|
||||
main: ['css/jquery.mobile-1.3.2.css', 'js/jquery.mobile-1.3.2.js']
|
||||
},
|
||||
'json2': {
|
||||
main: ['json2.js']
|
||||
},
|
||||
'modernizr': {
|
||||
main: 'modernizr.js'
|
||||
},
|
||||
'tinymce': {
|
||||
main: ['plugins/**',
|
||||
'skins/**',
|
||||
'themes/**',
|
||||
'*.js',
|
||||
'changelog.txt',
|
||||
'license.txt']
|
||||
},
|
||||
'underscore-amd': {
|
||||
main:
|
||||
'underscore.js'
|
||||
},
|
||||
zxcvbn: {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'jquery-galleria': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'bootstrap-multiselect': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'fancytree': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'jquery-ui': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'swfobject': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'blueimp-load-image': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'jquery-file-upload': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
},
|
||||
'i18next': {
|
||||
main: [/* ignore, will be copied manually for legacy code compatibility */]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task('copy-dev-vendors', function(){
|
||||
gulp.src(config.paths.vendors + 'chai/chai.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'chai/'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'js-fixtures/fixtures.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'js-fixtures/'));
|
||||
|
||||
gulp.src([config.paths.vendors + 'mocha/mocha.js', config.paths.vendors + 'mocha/mocha.css'])
|
||||
.pipe(gulp.dest( config.paths.dist + 'mocha/'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'sinon-chai/lib/sinon-chai.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'sinon-chai/'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'sinonjs/sinon.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'sinonjs/'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'squire/src/Squire.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'squire/'));
|
||||
|
||||
gulp.src([config.paths.vendors + 'qunit/qunit/qunit.js', config.paths.vendors + 'qunit/qunit/qunit.css'])
|
||||
.pipe(gulp.dest( config.paths.dist + 'qunit/'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'qunit/addons/phantomjs/*')
|
||||
.pipe(gulp.dest( config.paths.dist + 'qunit/addons/phantomjs'));
|
||||
});
|
||||
|
||||
gulp.task('copy-vendors-via-bower', function () {
|
||||
var vendorConfig = {
|
||||
'jquery-mobile-bower/css': {
|
||||
dirname: 'jquery-mobile'
|
||||
},
|
||||
'jquery-mobile-bower/js': {
|
||||
dirname: 'jquery-mobile'
|
||||
}
|
||||
};
|
||||
|
||||
return gulp.src(lib.ext().files, { base: config.paths.vendors })
|
||||
.pipe(rename(function (path) {
|
||||
if( vendorConfig[path.dirname] !== undefined ) {
|
||||
// console.log('reading path', path)
|
||||
var cuConf = vendorConfig[path.dirname];
|
||||
path.dirname = cuConf.dirname;
|
||||
}
|
||||
return path;
|
||||
}))
|
||||
.pipe(gulp.dest(config.paths.dist));
|
||||
});
|
||||
|
||||
// copy additionnal assets from vendors to match old legacy assets:
|
||||
gulp.task('copy-vendors', ['copy-vendors-via-bower'],function () {
|
||||
gulp.src([config.paths.vendors + 'fancytree/dist/skin-win8/**/*']) //, config.paths.vendors + 'fancytree/dist/jquery.fancytree-all.min
|
||||
.pipe(gulp.dest( config.paths.dist + 'fancytree/dist/skin-win8'))
|
||||
|
||||
gulp.src(config.paths.vendors + 'jquery-ui/ui/jquery-ui.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'jquery.ui/'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'jquery-ui/themes/base/*.css')
|
||||
.pipe(gulp.dest( config.paths.dist + 'jquery.ui/'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'jquery-ui/ui/i18n/*')
|
||||
.pipe(gulp.dest( config.paths.dist + 'jquery.ui/i18n'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'jquery-ui/themes/base/images/*')
|
||||
.pipe(gulp.dest( config.paths.dist + 'jquery.ui/images'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'swfobject/swfobject/swfobject.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'swfobject'));
|
||||
|
||||
|
||||
gulp.src([config.paths.vendors + 'jquery-file-upload/js/*', config.paths.vendors + 'jquery-file-upload/js/vendor/*', config.paths.vendors + 'jquery-file-upload/css/*'])
|
||||
.pipe(gulp.dest( config.paths.dist + 'jquery-file-upload'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'blueimp-load-image/js/*.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'blueimp-load-image'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'i18next/release/i18next.amd-1.6.3.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'i18next'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'bootstrap-multiselect/dist/**/*')
|
||||
.pipe(gulp.dest( config.paths.dist + 'bootstrap-multiselect'));
|
||||
|
||||
gulp.src([config.paths.vendors + 'jquery-galleria/src/galleria.js', config.paths.vendors + 'jquery-galleria/src/themes/classic/*'])
|
||||
.pipe(gulp.dest( config.paths.dist + 'jquery-galleria'));
|
||||
|
||||
gulp.src(config.paths.vendors + 'zxcvbn/dist/zxcvbn.js')
|
||||
.pipe(gulp.dest( config.paths.dist + 'zxcvbn'));
|
||||
|
||||
gulp.start('copy-dev-vendors');
|
||||
});
|
||||
|
||||
gulp.task('bootstrap-js', function () {
|
||||
var btSource = [
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-transition.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-alert.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-modal.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-dropdown.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-scrollspy.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-tab.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-tooltip.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-popover.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-button.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-collapse.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-carousel.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-typeahead.js',
|
||||
config.paths.vendors + 'bootstrap-sass/vendor/assets/javascripts/bootstrap-affix.js'];
|
||||
|
||||
gulp.src(btSource)
|
||||
.pipe(concat('bootstrap.js'))
|
||||
.pipe(gulp.dest( config.paths.dist + 'bootstrap/js'))
|
||||
.pipe(uglify())
|
||||
.pipe(rename({ extname: '.min.js' }))
|
||||
.pipe(gulp.dest( config.paths.dist + 'bootstrap/js'))
|
||||
});
|
||||
gulp.task('bootstrap-assets', function () {
|
||||
gulp.src([config.paths.vendors + 'bootstrap-sass/vendor/assets/images/**/*'])
|
||||
.pipe(gulp.dest( config.paths.dist + 'bootstrap/img'));
|
||||
|
||||
});
|
||||
gulp.task('build-bootstrap', ['bootstrap-assets', 'bootstrap-js'], function () {
|
||||
gulp.src(config.paths.vendors + 'bootstrap-sass/vendor/assets/stylesheets/bootstrap.scss')
|
||||
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
||||
.pipe(gulp.dest( config.paths.dist + 'bootstrap/css/'))
|
||||
.pipe(cssmin())
|
||||
.pipe(rename({ suffix: '.min' }))
|
||||
.pipe(gulp.dest( config.paths.dist + 'bootstrap/css'));
|
||||
gulp.src(config.paths.vendors + 'bootstrap-sass/vendor/assets/stylesheets/bootstrap-responsive.scss')
|
||||
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
||||
.pipe(gulp.dest( config.paths.dist + 'bootstrap/css/'))
|
||||
.pipe(cssmin())
|
||||
.pipe(rename({ suffix: '.min' }))
|
||||
.pipe(gulp.dest( config.paths.dist + 'bootstrap/css'));
|
||||
});
|
||||
|
||||
gulp.task('install-dependencies', function(done){
|
||||
return gulp.src(['./bower.json'])
|
||||
.pipe(install());
|
||||
});
|
||||
|
||||
gulp.task('copy-dependencies', ['install-dependencies'], function(){
|
||||
gulp.start('copy-vendors');
|
||||
gulp.start('build-bootstrap');
|
||||
});
|
||||
|
||||
|
||||
gulp.task('install-assets', ['clean:vendors'], function(){
|
||||
gulp.start('copy-dependencies');
|
||||
});
|
30
resources/gulp/test.js
Normal file
30
resources/gulp/test.js
Normal file
@@ -0,0 +1,30 @@
|
||||
var gulp = require('gulp');
|
||||
var qunit = require('gulp-qunit');
|
||||
var mochaPhantomjs = require('gulp-mocha-phantomjs');
|
||||
|
||||
var config = require('./config.js');
|
||||
|
||||
var paths = {
|
||||
vendors: 'tmp-assets/',
|
||||
dist: 'www/assets/'
|
||||
};
|
||||
|
||||
|
||||
gulp.task('mocha_phantomjs', function () {
|
||||
return gulp.src('www/scripts/tests/*.html')
|
||||
.pipe(mochaPhantomjs({
|
||||
'reporter': 'dot',
|
||||
'setting': [
|
||||
'loadImages=false'
|
||||
]
|
||||
}));
|
||||
});
|
||||
|
||||
gulp.task('qunit', function () {
|
||||
return gulp.src('www/include/js/tests/*.html')
|
||||
.pipe(qunit());
|
||||
});
|
||||
|
||||
|
||||
// js fixtures should be present (./bin/developer phraseanet:generate-js-fixtures)
|
||||
gulp.task('test', ['qunit','mocha_phantomjs']);
|
Reference in New Issue
Block a user