参考:https ://github.com/mgechev/angular-seed
我需要以下问题的帮助:我有一个自定义资产结构,我决定按文件夹格式化和分隔我的文件类型:
/img
/scss
/ts
/fonts
所以我不得不在 seed.config.ts 中更改路径名:
ASSETS_SRC = `${this.APP_SRC}/assets`;
/**
* The folder of the applications img files.
* @type {string}
*/
IMG_SRC = `${this.ASSETS_SRC}/img`;
/**
* The folder of the applications ts files.
* @type {string}
*/
TS_SRC = `${this.ASSETS_SRC}/ts`;
/**
* The folder of the applications fonts files.
* @type {string}
*/
FONT_SRC = `${this.ASSETS_SRC}/fonts`;
我想知道在新任务的任务/项目文件夹下是否必须将其称为与原始任务“build.assets.dev.ts, build.assets.prod.ts”相同的名称以覆盖它并将其添加到任务/项目文件夹?
像这样:
import * as gulp from 'gulp';
import { join } from 'path';
import { AssetsTask } from '../assets_task';
import Config from '../../config';
/**
* Executes the build process, copying the assets located in `src/client` over to the appropriate
* `dist/dev` directory.
*/
export =
class BuildAssetsTask extends AssetsTask {
run(done: any) {
let paths: string[] = [
join(Config.APP_SRC, '**'),
join(Config.NPM_BASE, '@angular', 'service-worker', 'bundles', 'worker-basic.js'),
'!' + join(Config.TS_SRC, '**', '*.ts'),
'!' + join(Config.SCSS_SRC, '**', '*.scss'),
'!' + join(Config.IMG_SRC, '**', '*.jpg|png|gif|svg|jpeg'),
'!' + join(Config.FONT_SRC, '**', '*.eot|woff|otf|ttf'),
].concat(Config.TEMP_FILES.map((p) => { return '!' + p; }));
return gulp.src(paths)
.pipe(gulp.dest(Config.APP_DEST));
}
};