gulpfile.js没有注入我的js文件

时间:2016-09-06 16:20:10

标签: gulp gulp-inject

我有以下文件夹结构

enter image description here

这是我的gulpfile.js

的副本
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');

var jsFiles = ['*.js', 'src/**/*.js'];

gulp.task('style', function() {
  return gulp.src(jsFiles)
    .pipe(jshint())
    .pipe(jshint.reporter('jshint-stylish', {
       verbose: true
    }))
    .pipe(jscs());
});

gulp.task('inject', function() {
  var wiredep = require('wiredep').stream;
  var inject = require('gulp-inject');

  var injectSrc = gulp.src(['./public/js/*.js', './public/css/*.css'],      {read: false});

  var injectOptions = {
    ignorePath: '/public'
  };

  var options = {
    bowerJson: require('./bower.json'),
    directoy: './public/lib',
    ignorePath: '../../public'
  };

  return gulp.src('./src/views/*.html')
    .pipe(wiredep(options))
    .pipe(inject(injectSrc, injectOptions))
    .pipe(gulp.dest('./src/views'));
 });

此文件中存在错误,因为css是注入的而不是js。

    <!-- inject:css -->
    <link rel="stylesheet" href="/css/styles.css">
    <!-- endinject -->
    <!-- inject.js -->
    <!-- endinject -->

这是控制台显示的消息。哪个没有向我显示任何错误。

enter image description here

0 个答案:

没有答案