mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 05:55:58 +08:00
Use new flarum-gulp package.
This commit is contained in:
parent
b28bf04e5a
commit
1c80a509f1
|
@ -1,15 +1,7 @@
|
||||||
var gulp = require('gulp');
|
var gulp = require('flarum-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 vendorFiles = [
|
gulp({
|
||||||
|
files: [
|
||||||
'../bower_components/loader.js/loader.js',
|
'../bower_components/loader.js/loader.js',
|
||||||
'../bower_components/mithril/mithril.js',
|
'../bower_components/mithril/mithril.js',
|
||||||
'../bower_components/jquery/dist/jquery.js',
|
'../bower_components/jquery/dist/jquery.js',
|
||||||
|
@ -17,35 +9,12 @@ var vendorFiles = [
|
||||||
'../bower_components/bootstrap/dist/js/bootstrap.js',
|
'../bower_components/bootstrap/dist/js/bootstrap.js',
|
||||||
'../bower_components/spin.js/spin.js',
|
'../bower_components/spin.js/spin.js',
|
||||||
'../bower_components/spin.js/jquery.spin.js'
|
'../bower_components/spin.js/jquery.spin.js'
|
||||||
];
|
],
|
||||||
|
moduleFiles: [
|
||||||
var moduleFiles = [
|
|
||||||
'src/**/*.js',
|
'src/**/*.js',
|
||||||
'../lib/**/*.js'
|
'../lib/**/*.js'
|
||||||
];
|
],
|
||||||
var modulePrefix = 'flarum';
|
bootstrapFiles: [],
|
||||||
|
modulePrefix: 'flarum',
|
||||||
gulp.task('default', function() {
|
outputFile: 'dist/app.js'
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
{
|
{
|
||||||
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.8.11",
|
"gulp": "^3.8.11",
|
||||||
"gulp-babel": "^5.1.0",
|
"flarum-gulp": "git+https://github.com/flarum/gulp.git"
|
||||||
"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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
var gulp = require('gulp');
|
var gulp = require('flarum-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 vendorFiles = [
|
gulp({
|
||||||
|
files: [
|
||||||
'../bower_components/loader.js/loader.js',
|
'../bower_components/loader.js/loader.js',
|
||||||
'../bower_components/mithril/mithril.js',
|
'../bower_components/mithril/mithril.js',
|
||||||
'../bower_components/jquery/dist/jquery.js',
|
'../bower_components/jquery/dist/jquery.js',
|
||||||
|
@ -19,35 +11,12 @@ var vendorFiles = [
|
||||||
'../bower_components/bootstrap/dist/js/bootstrap.js',
|
'../bower_components/bootstrap/dist/js/bootstrap.js',
|
||||||
'../bower_components/spin.js/spin.js',
|
'../bower_components/spin.js/spin.js',
|
||||||
'../bower_components/spin.js/jquery.spin.js'
|
'../bower_components/spin.js/jquery.spin.js'
|
||||||
];
|
],
|
||||||
|
moduleFiles: [
|
||||||
var moduleFiles = [
|
|
||||||
'src/**/*.js',
|
'src/**/*.js',
|
||||||
'../lib/**/*.js'
|
'../lib/**/*.js'
|
||||||
];
|
],
|
||||||
var modulePrefix = 'flarum';
|
bootstrapFiles: [],
|
||||||
|
modulePrefix: 'flarum',
|
||||||
gulp.task('default', function() {
|
outputFile: 'dist/app.js'
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
{
|
{
|
||||||
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.8.11",
|
"gulp": "^3.8.11",
|
||||||
"gulp-babel": "^5.1.0",
|
"flarum-gulp": "git+https://github.com/flarum/gulp.git"
|
||||||
"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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user