Im irgendwie zu Verlust hier.FountainJs - Wo werden app.js und vendor.js generiert
Im mit fountainJs für ein Projekt, die folgenden Konfigurationen:
- AngularJS 1.5
- Reines Javascript
- Gulp
- SCC
Die Sache ist, ich diese Projektstruktur haben:
SRC
|- APP
|-folder1
|- file1.js
|- file2.js
|-folder2
|- file3.js
|- file4.js
|- common1.js
environment_variable='folder1'
Und möchten, dass app.js sind nur JS-Dateien aus einem Ordner, durch die Umgebungsvariable definiert (file1.js, file2.js), plus, die gewöhnlichsten (common1.js). Stattdessen enthält es jedes Mal, wenn ich einen Build mache, alle JS-Dateien, die in die app.js hochgeladen wurden, wodurch alle Arten von Konflikten entstehen.
Irgendwelche Ideen oder Anleitungen für mich zu verwenden? Ich vermute, dass das die build.js-Datei ist, die all das macht, kaufe ich verstehe nicht, was dort vor sich geht.
const gulp = require('gulp');
const filter = require('gulp-filter');
const useref = require('gulp-useref');
const lazypipe = require('lazypipe');
const rev = require('gulp-rev');
const revReplace = require('gulp-rev-replace');
const uglify = require('gulp-uglify');
const cssnano = require('gulp-cssnano');
const htmlmin = require('gulp-htmlmin');
const sourcemaps = require('gulp-sourcemaps');
const uglifySaveLicense = require('uglify-save-license');
const inject = require('gulp-inject');
const ngAnnotate = require('gulp-ng-annotate');
const conf = require('../conf/gulp.conf');
gulp.task('build', build);
function build() {
const partialsInjectFile = gulp.src(conf.path.tmp('templateCacheHtml.js'), {read: false});
const partialsInjectOptions = {
starttag: '<!-- inject:partials -->',
ignorePath: conf.paths.tmp,
addRootSlash: false
};
const htmlFilter = filter(conf.path.tmp('*.html'), {restore: true});
const jsFilter = filter(conf.path.tmp('**/*.js'), {restore: true});
const cssFilter = filter(conf.path.tmp('**/*.css'), {restore: true});
return gulp.src(conf.path.tmp('/index.html'))
.pipe(inject(partialsInjectFile, partialsInjectOptions))
.pipe(useref({}, lazypipe().pipe(sourcemaps.init, {loadMaps: true})))
.pipe(jsFilter)
.pipe(ngAnnotate())
.pipe(uglify({preserveComments: uglifySaveLicense})).on('error', conf.errorHandler('Uglify'))
.pipe(rev())
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe(cssnano())
.pipe(rev())
.pipe(cssFilter.restore)
.pipe(revReplace())
.pipe(sourcemaps.write('maps'))
.pipe(htmlFilter)
.pipe(htmlmin())
.pipe(htmlFilter.restore)
.pipe(gulp.dest(conf.path.dist()))
.pipe(gulp.src(conf.path.src('/templates/**/*')).pipe(gulp.dest(conf.path.dist('/templates'))));
}