Gulp and wired fingerprint non-insert file type *. *. js files

I ran into a problem below -

I have a Yeomen generator and wiredep to inject bower dependencies in index.html.

I installed the angular tree view by bower tree and then noticed that the lib and css files of the angular tree view are not being entered into the index file.

After debugging, until it is discovered that the lib file in the angular tree has one additional point (angular.treeview.js), the same with the css file, as well

So how to add this file to index.html

I have the following task in inject.js file in gulp folder to insert file in index.html generated by yoemen

gulp.task('inject', ['scripts'], function () { var injectStyles = gulp.src([ path.join(conf.paths.src, '/app/**/*.css') ], { read: false }); var injectScripts = gulp.src([ path.join(conf.paths.src, '/app/**/*.module.js'), path.join(conf.paths.src, '/app/**/*.js'), path.join('!' + conf.paths.src, '/app/**/*.spec.js'), path.join('!' + conf.paths.src, '/app/**/*.mock.js') ]) .pipe($.angularFilesort()).on('error',conf.errorHandler('AngularFilesort')); var injectOptions = { ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve')], addRootSlash: false }; return gulp.src(path.join(conf.paths.src, '/*.html')) .pipe($.inject(injectStyles, injectOptions)) .pipe($.inject(injectScripts, injectOptions)) .pipe(wiredep(_.extend({}, conf.wiredep))) .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve'))); } 

I use yomen and gulp. Any help would be greatly appreciated.

+1
source share
1 answer

It should not do anything with your gulp task. Wiredep uses the bower.json file to inject dependencies in your index file.

In case of any problem, as in your current scenario, you just need to redefine your package, for example, to download. add below code in bower.json

  "overrides": { "bootstrap": { "main": [ "dist/css/bootstrap.css", "dist/fonts/glyphicons-halflings-regular.eot", "dist/fonts/glyphicons-halflings-regular.svg", "dist/fonts/glyphicons-halflings-regular.ttf", "dist/fonts/glyphicons-halflings-regular.woff", "dist/fonts/glyphicons-halflings-regular.woff2" ] }, "angular-treeview":{ "main":[ "angular.treeview.js", "css/angular.treeview.css" ] } } 

Hope this helps you. Happy coding :)

+2
source

Source: https://habr.com/ru/post/1203808/


All Articles