mirror of
https://github.com/flarum/framework.git
synced 2024-12-11 21:43:38 +08:00
Use new flarum-gulp package.
This commit is contained in:
parent
b28bf04e5a
commit
1c80a509f1
|
@ -1,51 +1,20 @@
|
|||
var gulp = require('gulp');
|
||||
var livereload = require('gulp-livereload');
|
||||
var concat = require('gulp-concat');
|
||||
var argv = require('yargs').argv;
|
||||
var uglify = require('gulp-uglify');
|
||||
var gulpif = require('gulp-if');
|
||||
var merge = require('merge-stream');
|
||||
var babel = require('gulp-babel');
|
||||
var cached = require('gulp-cached');
|
||||
var remember = require('gulp-remember');
|
||||
var gulp = require('flarum-gulp');
|
||||
|
||||
var vendorFiles = [
|
||||
'../bower_components/loader.js/loader.js',
|
||||
'../bower_components/mithril/mithril.js',
|
||||
'../bower_components/jquery/dist/jquery.js',
|
||||
'../bower_components/moment/moment.js',
|
||||
'../bower_components/bootstrap/dist/js/bootstrap.js',
|
||||
'../bower_components/spin.js/spin.js',
|
||||
'../bower_components/spin.js/jquery.spin.js'
|
||||
];
|
||||
|
||||
var moduleFiles = [
|
||||
'src/**/*.js',
|
||||
'../lib/**/*.js'
|
||||
];
|
||||
var modulePrefix = 'flarum';
|
||||
|
||||
gulp.task('default', function() {
|
||||
return merge(
|
||||
gulp.src(vendorFiles),
|
||||
gulp.src(moduleFiles)
|
||||
.pipe(cached('scripts'))
|
||||
.pipe(babel({ modules: 'amd', moduleIds: true, moduleRoot: modulePrefix }))
|
||||
.pipe(remember('scripts'))
|
||||
)
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(gulpif(argv.production, uglify()))
|
||||
.pipe(gulp.dest('dist'))
|
||||
.pipe(livereload());
|
||||
});
|
||||
|
||||
gulp.task('watch', ['default'], function () {
|
||||
livereload.listen();
|
||||
var watcher = gulp.watch(moduleFiles.concat(vendorFiles), ['default']);
|
||||
watcher.on('change', function (event) {
|
||||
if (event.type === 'deleted') {
|
||||
delete cached.caches.scripts[event.path];
|
||||
remember.forget('scripts', event.path);
|
||||
}
|
||||
});
|
||||
gulp({
|
||||
files: [
|
||||
'../bower_components/loader.js/loader.js',
|
||||
'../bower_components/mithril/mithril.js',
|
||||
'../bower_components/jquery/dist/jquery.js',
|
||||
'../bower_components/moment/moment.js',
|
||||
'../bower_components/bootstrap/dist/js/bootstrap.js',
|
||||
'../bower_components/spin.js/spin.js',
|
||||
'../bower_components/spin.js/jquery.spin.js'
|
||||
],
|
||||
moduleFiles: [
|
||||
'src/**/*.js',
|
||||
'../lib/**/*.js'
|
||||
],
|
||||
bootstrapFiles: [],
|
||||
modulePrefix: 'flarum',
|
||||
outputFile: 'dist/app.js'
|
||||
});
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-babel": "^5.1.0",
|
||||
"gulp-cached": "^1.0.4",
|
||||
"gulp-concat": "^2.5.2",
|
||||
"gulp-if": "^1.2.5",
|
||||
"gulp-livereload": "^3.8.0",
|
||||
"gulp-remember": "^0.3.0",
|
||||
"gulp-uglify": "^1.2.0",
|
||||
"merge-stream": "^0.1.7",
|
||||
"yargs": "^3.7.2"
|
||||
"flarum-gulp": "git+https://github.com/flarum/gulp.git"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,22 @@
|
|||
var gulp = require('gulp');
|
||||
var livereload = require('gulp-livereload');
|
||||
var concat = require('gulp-concat');
|
||||
var argv = require('yargs').argv;
|
||||
var uglify = require('gulp-uglify');
|
||||
var gulpif = require('gulp-if');
|
||||
var merge = require('merge-stream');
|
||||
var babel = require('gulp-babel');
|
||||
var cached = require('gulp-cached');
|
||||
var remember = require('gulp-remember');
|
||||
var gulp = require('flarum-gulp');
|
||||
|
||||
var vendorFiles = [
|
||||
'../bower_components/loader.js/loader.js',
|
||||
'../bower_components/mithril/mithril.js',
|
||||
'../bower_components/jquery/dist/jquery.js',
|
||||
'../bower_components/jquery.hotkeys/jquery.hotkeys.js',
|
||||
'../bower_components/color-thief/js/color-thief.js',
|
||||
'../bower_components/moment/moment.js',
|
||||
'../bower_components/bootstrap/dist/js/bootstrap.js',
|
||||
'../bower_components/spin.js/spin.js',
|
||||
'../bower_components/spin.js/jquery.spin.js'
|
||||
];
|
||||
|
||||
var moduleFiles = [
|
||||
'src/**/*.js',
|
||||
'../lib/**/*.js'
|
||||
];
|
||||
var modulePrefix = 'flarum';
|
||||
|
||||
gulp.task('default', function() {
|
||||
return merge(
|
||||
gulp.src(vendorFiles),
|
||||
gulp.src(moduleFiles)
|
||||
.pipe(cached('scripts'))
|
||||
.pipe(babel({ modules: 'amd', moduleIds: true, moduleRoot: modulePrefix }))
|
||||
.pipe(remember('scripts'))
|
||||
)
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(gulpif(argv.production, uglify()))
|
||||
.pipe(gulp.dest('dist'))
|
||||
.pipe(livereload());
|
||||
});
|
||||
|
||||
gulp.task('watch', ['default'], function () {
|
||||
livereload.listen();
|
||||
var watcher = gulp.watch(moduleFiles.concat(vendorFiles), ['default']);
|
||||
watcher.on('change', function (event) {
|
||||
if (event.type === 'deleted') {
|
||||
delete cached.caches.scripts[event.path];
|
||||
remember.forget('scripts', event.path);
|
||||
}
|
||||
});
|
||||
gulp({
|
||||
files: [
|
||||
'../bower_components/loader.js/loader.js',
|
||||
'../bower_components/mithril/mithril.js',
|
||||
'../bower_components/jquery/dist/jquery.js',
|
||||
'../bower_components/jquery.hotkeys/jquery.hotkeys.js',
|
||||
'../bower_components/color-thief/js/color-thief.js',
|
||||
'../bower_components/moment/moment.js',
|
||||
'../bower_components/bootstrap/dist/js/bootstrap.js',
|
||||
'../bower_components/spin.js/spin.js',
|
||||
'../bower_components/spin.js/jquery.spin.js'
|
||||
],
|
||||
moduleFiles: [
|
||||
'src/**/*.js',
|
||||
'../lib/**/*.js'
|
||||
],
|
||||
bootstrapFiles: [],
|
||||
modulePrefix: 'flarum',
|
||||
outputFile: 'dist/app.js'
|
||||
});
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-babel": "^5.1.0",
|
||||
"gulp-cached": "^1.0.4",
|
||||
"gulp-concat": "^2.5.2",
|
||||
"gulp-if": "^1.2.5",
|
||||
"gulp-livereload": "^3.8.0",
|
||||
"gulp-remember": "^0.3.0",
|
||||
"gulp-uglify": "^1.2.0",
|
||||
"merge-stream": "^0.1.7",
|
||||
"yargs": "^3.7.2"
|
||||
"flarum-gulp": "git+https://github.com/flarum/gulp.git"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user