gulp-concat モジュールをインストールし、ライブラリを連結しようとしていますが、vendor.js ファイルを作成したくないようです。私はガクガクするのはかなり新しいです。私のgulpfileの一番上に
var gulp = require('gulp'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
gulpVendor = require('gulp-concat-vendor'),
less = require('gulp-less'),
csso = require('gulp-csso'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
autoprefixer = require('gulp-autoprefixer'),
stylish = require('jshint-stylish'),
debug = require('gulp-debug'),
tap = require('gulp-tap'),
templateCache = require('gulp-angular-templatecache'),
widgetsTemplatesLoader = require('./tools/widgets-templates-loader');
var dirs = {
content: './Content',
tmp: './.tmp',
templates: './Content/templates',
bower: './bower_components'
};
dirs.templates = dirs.content + '/templates';
dirs.dist = dirs.content + '/dist';
dirs.app = dirs.content + '/app';
dirs.modules = dirs.app + '/modules';
dirs.fonts = dirs.content + '/fonts';
dirs.css = dirs.content + '/css';
var paths = {
scripts: {
app: [dirs.app + '/**/*.js',
'!' + dirs.app + '/widgets/**/*.js'],
vendor: [
dirs.bower + '/lodash/lodash.js',
dirs.bower + '/jquery/dist/jquery.js',
dirs.bower + '/jquery-ui/jquery-ui.js',
dirs.bower + '/jqueryui-timepicker-addon/dist/jquery-ui-timepicker-addon.js',
dirs.bower + '/Sortable/Sortable.js',
// angular
dirs.bower + '/angular/angular.js',
dirs.bower + '/angular-ui-router/release/angular-ui-router.js',
dirs.bower + '/angular-bootstrap/ui-bootstrap.js',
dirs.bower + '/angular-bootstrap/ui-bootstrap-tpls.js',
dirs.bower + '/angular-dashboard-framework/dist/angular-dashboard-framework.js',
dirs.bower + '/angular-ui-notification/dist/angular-ui-notification.js',
dirs.bower + '/moment/moment.js',
dirs.bower + '/ui-select/dist/select.js',
dirs.bower + '/javascript-detect-element-resize/jquery.resize.js',
dirs.bower + '/angular-gridster/dist/angular-gridster.min.js',
dirs.bower + '/highcharts/highcharts.src.js',
dirs.bower + '/ng-resize/dist/ng-resize.js',
dirs.bower + '/bootstrap-daterangepicker/daterangepicker.js',
dirs.bower + '/angular-daterangepicker/js/angular-daterangepicker.js',
dirs.bower + '/showdown/compressed/Showdown.js',
dirs.bower + '/angular-markdown-directive/markdown.js',
dirs.bower + '/angular-modal-service/dst/angular-modal-service.js'
]
},
widgets: dirs.app + '/widgets',
less: [
dirs.bower + '/angular-gridster/dist/angular-gridster.min.css',
dirs.bower + '/angular-ui-notification/dist/angular-ui-notification.css',
dirs.bower + '/jquery-ui/themes/smoothness/jquery-ui.css',
dirs.bower + '/jqueryui-timepicker-addon/dist/jquery-ui-timepicker-addon.css',
dirs.bower + '/icomoon-bower/style.css',
dirs.bower + '/ui-select/dist/select.css',
dirs.bower + '/select2/select2.css',
dirs.bower + '/font-awesome/less/font-awesome.less',
dirs.content + '/less/_main/*.less'
],
cleanup: [
dirs.tmp,
'!' + dirs.dist + '/.gitignore',
dirs.dist + '/**/*.*'
]
};
そして、ここに私が連結しようとしている私のタスクがあります:
gulp.task('scripts-dev-vendor', function() {
return gulp.src(paths.scripts.vendor)
.pipe(debug())
.pipe(gulpVendor('vendor.js'))
.pipe(gulp.dest(dirs.dist));
});
gulp.task('scripts-prod-vendor', function() {
return gulp.src(paths.scripts.vendor)
.pipe(debug())
.pipe(gulpVendor('vendor.js'))
.pipe(gulp.dest(dirs.dist))
.pipe(rename(function(path) { path.basename += '.min'; }))
.pipe(uglify({
preserveComments: 'some',
outSourceMap: true
}))
.pipe(gulp.dest(dirs.dist));
});
その特定のタスクを実行したときの出力は次のとおりです。
[15:59:43] Starting 'scripts-dev-vendor'...
[15:59:43] Starting 'widgets-templates'...
[15:59:43] Starting 'compile-modules-templates'...
[15:59:43] gulp-debug: 0 items
[15:59:43] Finished 'widgets-templates' after 72 ms
[15:59:43] Starting 'widgets'...
[15:59:43] gulp-debug: Content\app\widgets\table\table.js
[15:59:43] gulp-debug: .tmp\widgets-templates.tpl.js
[15:59:43] gulp-debug: 2 items
[15:59:43] Finished 'widgets' after 38 ms
[15:59:43] Finished 'compile-modules-templates' after 158 ms
[15:59:43] Starting 'compile-templates'...
[15:59:43] Finished 'compile-templates' after 6.47 ms
[15:59:43] Starting 'scripts-dev-app'...
[15:59:43] gulp-debug: .tmp\widgets.js
[15:59:43] gulp-debug: Content\app\app.js
[15:59:43] gulp-debug: .tmp\modules-templates.js
[15:59:43] gulp-debug: Content\app\common\module.js
[15:59:43] gulp-debug: Content\app\config\api-config.js
[15:59:43] gulp-debug: Content\app\config\global-const.js
[15:59:43] gulp-debug: Content\app\interceptors\auth.js
[15:59:43] gulp-debug: Content\app\interceptors\error.js
[15:59:43] gulp-debug: Content\app\services\module.js
[15:59:43] gulp-debug: Content\app\thirdparty\constellation.js
[15:59:43] gulp-debug: Content\app\thirdparty\ie10-viewport-bug-workaround.js
[15:59:43] gulp-debug: Content\app\modules\account\module.js
[15:59:43] gulp-debug: Content\app\modules\dashboard\module.js
[15:59:43] gulp-debug: Content\app\modules\environment\module.js
[15:59:43] gulp-debug: Content\app\modules\layout\module.js
[15:59:43] gulp-debug: Content\app\modules\settings\module.js
[15:59:43] gulp-debug: Content\app\services\api\account.js
[15:59:43] gulp-debug: Content\app\services\api\dashboard.js
[15:59:43] gulp-debug: Content\app\services\api\device.js
[15:59:43] gulp-debug: Content\app\services\api\metrics.js
[15:59:43] gulp-debug: Content\app\services\api\pathfinder.js
[15:59:43] gulp-debug: Content\app\services\common\auth.js
[15:59:43] gulp-debug: Content\app\services\common\cachedCollection.js
[15:59:43] gulp-debug: Content\app\services\common\helpers.js
[15:59:43] gulp-debug: Content\app\services\common\modal.js
[15:59:43] gulp-debug: Content\app\services\common\responseFormator.js
[15:59:43] gulp-debug: Content\app\services\common\spinner.js
[15:59:43] gulp-debug: Content\app\services\common\splash.js
[15:59:43] gulp-debug: Content\app\common\directives\hcChart\directive.js
[15:59:43] gulp-debug: Content\app\common\directives\jqDatepicker\directive.js
[15:59:43] gulp-debug: Content\app\common\directives\page-spinner\directive.js
[15:59:43] gulp-debug: Content\app\common\directives\resize\directive.js
[15:59:43] gulp-debug: Content\app\modules\account\controllers\account.controller.js
[15:59:43] gulp-debug: Content\app\modules\account\controllers\login.controller.js
[15:59:43] gulp-debug: Content\app\modules\dashboard\dashboard\controllers\dashboard.controller.js
[15:59:43] gulp-debug: Content\app\modules\environment\devices\controllers\device.view.controller.js
[15:59:43] gulp-debug: Content\app\modules\environment\devices\controllers\devices.controller.js
[15:59:43] gulp-debug: Content\app\modules\layout\header\controllers\header.controller.js
[15:59:43] gulp-debug: Content\app\modules\layout\layout\controllers\root.controller.js
[15:59:43] gulp-debug: Content\app\modules\layout\second-sidebar\controllers\second-sidebar.controller.js
[15:59:43] gulp-debug: Content\app\modules\layout\sidebar\controllers\sidebar.controller.js
[15:59:43] gulp-debug: Content\app\modules\modals\confirmation\controllers\modal.controller.js
[15:59:43] gulp-debug: Content\app\modules\modals\timerange\controllers\modal.controller.js
[15:59:43] gulp-debug: Content\app\modules\settings\DeviceTypes\controllers\deviceType.controller.js
[15:59:43] gulp-debug: Content\app\modules\settings\DeviceTypes\controllers\deviceTypes.controller.js
[15:59:43] gulp-debug: Content\app\modules\settings\users\controllers\companies.controller.js
[15:59:43] gulp-debug: Content\app\modules\settings\users\controllers\company.controller.js
[15:59:43] gulp-debug: Content\app\modules\settings\users\controllers\user.controller.js
[15:59:43] gulp-debug: Content\app\modules\modals\device\add\controllers\modal.controller.js
[15:59:43] gulp-debug: Content\app\modules\modals\device\edit\controllers\modal.controller.js
[15:59:43] gulp-debug: 50 items
[15:59:43] Finished 'scripts-dev-app' after 147 ms
Process terminated with code 0.
これは、scripts-dev-vendor タスクを開始する方法です
// composite tasks
gulp.task('scripts-dev', ['scripts-dev-vendor', 'scripts-dev-app']);
gulp.task('scripts-prod', ['scripts-prod-vendor', 'scripts-prod-app']);
gulp.task('common-static', ['assets']);
// build task
gulp.task('build', ['cleanup'], function () {
gulp.start('common-static', 'lint', 'scripts-prod', 'css-prod');
});
gulp.task('dev', ['cleanup'], function () {
gulp.start('common-static', 'lint', 'scripts-dev', 'css-dev');
});
scripts-dev-vendor タスクを単独で実行すると、次のエラーが表示されます。
[10:59:50] Task 'scripts-dev:scripts-dev-vendor' is not in your gulpfile
[10:59:50] Please check the documentation for proper gulpfile formatting