Gruntjs 添加翡翠后不能再咕哝建造

Gruntjs 添加翡翠后不能再咕哝建造,gruntjs,pug,Gruntjs,Pug,我有一个角度的项目,我用约曼建立。它最初是纯JavaScript和HTML。不久前,我将JavaScript转换为CoffeeScript,然后将HTML转换为Jade 我的应用程序功能刚刚好,因为我的模板是Jade,但我无法再成功运行grunt build。当我尝试时,我得到了以下结果: >> No "concat" targets found. 我没有看到任何关于concat任务的定义,所以我想这是有意义的,但我以前从未有过concat定义,而且它工作得很好 供参考 还有,这是

我有一个角度的项目,我用约曼建立。它最初是纯JavaScript和HTML。不久前,我将JavaScript转换为CoffeeScript,然后将HTML转换为Jade

我的应用程序功能刚刚好,因为我的模板是Jade,但我无法再成功运行
grunt build
。当我尝试时,我得到了以下结果:

>> No "concat" targets found.
我没有看到任何关于
concat
任务的定义,所以我想这是有意义的,但我以前从未有过
concat
定义,而且它工作得很好

供参考

还有,这是我的建议

如有任何建议,我们将不胜感激


Edit:FWIW,看起来我的问题是从我将
app/index.html
更改为
app/index.jade

开始的,所以如果我有RTFM,问题/解决方案一直在我的眼皮底下

在某个时间点上,我遵循了一个原则。我基本上是照本宣科,但我错过了这个关键的新闻:

上面的示例告诉Jade在
文件夹中查找
.Jade
文件,并将它们编译到
.tmp
文件夹中。由于
watch:livereload
useminPrepare
htmlmin
正在
中查找您的HTML文件,我们必须更改它们。为此,只需将指向
/*.html
的引用替换为
.tmp/*.html

我更改了一些引用,抖动了一些旋钮,现在
grunt build
可以工作了。这是我的
Grunfile.coffee的工作版本:

# Generated on 2014-11-05 using generator-angular 0.9.8
'use strict'
# # Globbing
# for performance reasons we're only matching one level down:
# 'test/spec/{,*/}*.js'
# use this if you want to recursively match all subfolders:
# 'test/spec/**/*.js'

module.exports = (grunt) ->
  # Load grunt tasks automatically
  require('load-grunt-tasks') grunt
  # Time how long tasks take. Can help when optimizing build times
  require('time-grunt') grunt
  # Configurable paths for the application
  appConfig =
    app: require('./bower.json').appPath or 'app'
    dist: '../public'
  modRewrite = require('connect-modrewrite')

  # Define the configuration for all the tasks
  grunt.initConfig
    yeoman: appConfig
    watch:
      bower:
        files: [ 'bower.json' ]
        tasks: [ 'wiredep' ]
      js:
        files: [ '<%= yeoman.app %>/scripts/{,*/}*.js' ]
        tasks: [ 'newer:jshint:all' ]
        options: livereload: '<%= connect.options.livereload %>'
      jade:
        files: ['<%= yeoman.app %>/**/*.jade'],
        tasks: ['jade']
      coffee:
        files: [ '<%= yeoman.app %>/scripts/{,*/}*.{coffee,litcoffee,coffee.md}' ]
        tasks: [ 'newer:coffee:dist']
      jsTest:
        files: [ 'test/spec/{,*/}*.js' ]
        tasks: [
          'newer:jshint:test'
          'karma'
        ]
      compass:
        files: [ '<%= yeoman.app %>/styles/{,*/}*.{scss,sass}' ]
        tasks: [
          'compass:server'
          'autoprefixer'
        ]
      gruntfile: files: [ 'Gruntfile.js' ]
      livereload:
        options: livereload: '<%= connect.options.livereload %>'
        files: [
          '.tmp/{,*/}*.html'
          '.tmp/styles/{,*/}*.css'
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
    connect:
      options:
        port: 9000
        hostname: 'localhost'
        livereload: 35729
      proxies: [ {
        context: '/api'
        host: 'localhost'
        port: 3000
      } ]
      livereload: options:
        open: true
        middleware: (connect, options) ->
          if !Array.isArray(options.base)
            options.base = [ options.base ]
          middlewares = [
            modRewrite([ '!/api|/assets|\\..+$ /index.html' ])
            require('grunt-connect-proxy/lib/utils').proxyRequest
            connect.static('.tmp')
            connect().use('/bower_components', connect.static('./bower_components'))
            connect.static(appConfig.app)
          ]
          # Make directory browse-able.
          directory = options.directory or options.base[options.base.length - 1]
          middlewares.push connect.directory(directory)
          middlewares
      test: options:
        port: 9001
        middleware: (connect) ->
          [
            connect.static('.tmp')
            connect.static('test')
            connect().use('/bower_components', connect.static('./bower_components'))
            connect.static(appConfig.app)
          ]
      dist: options:
        open: true
        base: '<%= yeoman.dist %>'
    jshint:
      options:
        jshintrc: '.jshintrc'
        reporter: require('jshint-stylish')
      all: src: [
        'Gruntfile.js'
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ]
      test:
        options: jshintrc: 'test/.jshintrc'
        src: [ 'test/spec/{,*/}*.js' ]
    clean:
      dist: files: [ {
        dot: true
        src: [
          '.tmp'
          '<%= yeoman.dist %>/{,*/}*'
          '!<%= yeoman.dist %>/.git*'
        ]
      } ]
      server: '.tmp'
    autoprefixer:
      options: browsers: [ 'last 1 version' ]
      dist: files: [ {
        expand: true
        cwd: '.tmp/styles/'
        src: '{,*/}*.css'
        dest: '.tmp/styles/'
      } ]
    wiredep:
      app:
        src: [ '<%= yeoman.app %>/index.jade' ]
        ignorePath: /\.\.\//
      sass:
        src: [ '<%= yeoman.app %>/styles/{,*/}*.{scss,sass}' ]
        ignorePath: /(\.\.\/){1,2}bower_components\//
    jade:
      dist:
        options:
          pretty: true
          data:
            debug: true
        files: [
          expand: true
          cwd: '<%= yeoman.app %>'
          dest: '.tmp'
          src: '**/*.jade'
          ext: '.html'
        ]
    coffee:
      options:
        sourceMap: true
        bare: true
        sourceRoot: ''
      dist:
        files: [
          expand: true
          cwd: '<%= yeoman.app %>/scripts'
          src: '{,*/}*.coffee'
          dest: '.tmp/scripts'
          ext: '.js'
        ]
      test:
        files: [
          expand: true
          cwd: 'test/spec'
          src: '{,*/}*.coffee'
          dest: '.tmp/spec'
          ext: '.js'
        ]
    compass:
      options:
        sassDir: '<%= yeoman.app %>/styles'
        cssDir: '.tmp/styles'
        generatedImagesDir: '.tmp/images/generated'
        imagesDir: '<%= yeoman.app %>/images'
        javascriptsDir: '<%= yeoman.app %>/scripts'
        fontsDir: '<%= yeoman.app %>/styles/fonts'
        importPath: './bower_components'
        httpImagesPath: '/images'
        httpGeneratedImagesPath: '/images/generated'
        httpFontsPath: '/styles/fonts'
        relativeAssets: false
        assetCacheBuster: false
        raw: 'Sass::Script::Number.precision = 10\n'
      dist: options: generatedImagesDir: '<%= yeoman.dist %>/images/generated'
      server: options: debugInfo: true
    filerev: dist: src: [
      '<%= yeoman.dist %>/scripts/{,*/}*.js'
      '<%= yeoman.dist %>/styles/{,*/}*.css'
      '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
      '<%= yeoman.dist %>/styles/fonts/*'
    ]
    useminPrepare:
      html: '.tmp/index.html'
      options:
        dest: '<%= yeoman.dist %>'
        flow: html:
          steps:
            js: [
              'concat'
              'uglifyjs'
            ]
            css: [ 'cssmin' ]
          post: {}
    usemin:
      html: [ '.tmp/**/*.html' ]
      css: [ '<%= yeoman.dist %>/styles/{,*/}*.css' ]
      options: assetsDirs: [
        '<%= yeoman.dist %>'
        '<%= yeoman.dist %>/images'
      ]
    imagemin: dist: files: [ {
      expand: true
      cwd: '<%= yeoman.app %>/images'
      src: '{,*/}*.{png,jpg,jpeg,gif}'
      dest: '<%= yeoman.dist %>/images'
    } ]
    svgmin: dist: files: [ {
      expand: true
      cwd: '<%= yeoman.app %>/images'
      src: '{,*/}*.svg'
      dest: '<%= yeoman.dist %>/images'
    } ]
    htmlmin: dist:
      options:
        collapseWhitespace: true
        conservativeCollapse: true
        collapseBooleanAttributes: true
        removeCommentsFromCDATA: true
        removeOptionalTags: true
      files: [ {
        expand: true
        cwd: '.tmp'
        src: [
          '*.html'
          '**/*.html'
        ]
        dest: '<%= yeoman.dist %>'
      } ]
    ngAnnotate: dist: files: [ {
      expand: true
      cwd: '.tmp/concat/scripts'
      src: [
        '*.js'
        '!oldieshim.js'
      ]
      dest: '.tmp/concat/scripts'
    } ]
    cdnify: dist: html: [ '<%= yeoman.dist %>/*.html' ]
    copy:
      dist: files: [
        {
          expand: true
          dot: true
          cwd: '<%= yeoman.app %>'
          dest: '<%= yeoman.dist %>'
          src: [
            '*.{ico,png,txt}'
            '.htaccess'
            '*.html'
            '**/*.html'
            'images/{,*/}*.{webp}'
            'fonts/*'
          ]
        }
        {
          expand: true
          cwd: '.tmp/images'
          dest: '<%= yeoman.dist %>/images'
          src: [ 'generated/*' ]
        }
        {
          expand: true
          cwd: '.'
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*'
          dest: '<%= yeoman.dist %>'
        }
      ]
      styles:
        expand: true
        cwd: '<%= yeoman.app %>/styles'
        dest: '.tmp/styles/'
        src: '{,*/}*.css'
    concurrent:
      server: [
        'jade:dist'
        'coffee:dist'
        'compass:server'
      ]
      test: [ 'compass' ]
      dist: [
        'jade'
        'coffee'
        'compass:dist'
        'imagemin'
        'svgmin'
      ]
    karma: unit:
      configFile: 'test/karma.conf.js'
      singleRun: true
  grunt.registerTask 'serve', 'Compile then start a connect web server', (target) ->
    if target == 'dist'
      return grunt.task.run([
        'build'
        'connect:dist:keepalive'
      ])
    grunt.task.run [
      'clean:server'
      'wiredep'
      'railsServer:development'
      'concurrent:server'
      'autoprefixer'
      'configureProxies'
      'connect:livereload'
      'watch'
    ]
    return
  grunt.registerTask 'server', 'DEPRECATED TASK. Use the "serve" task instead', (target) ->
    grunt.log.warn 'The `server` task has been deprecated. Use `grunt serve` to start a server.'
    grunt.task.run [ 'serve:' + target ]
    return
  grunt.registerTask 'test', [
    'clean:server'
    'concurrent:test'
    'autoprefixer'
    'connect:test'
    'karma'
  ]
  grunt.registerTask 'build', [
    'clean:dist'
    'jade'
    'coffee'
    'wiredep'
    'useminPrepare'
    'concurrent:dist'
    'autoprefixer'
    'concat'
    'ngAnnotate'
    'copy:dist'
    'cdnify'
    'cssmin'
    'uglify'
    'filerev'
    'usemin'
    'htmlmin'
  ]
  grunt.registerTask 'default', [
    'newer:jshint'
    'test'
    'build'
  ]

  grunt.registerTask 'heroku:production', 'build'

  grunt.loadNpmTasks 'grunt-contrib-jade'
  grunt.loadNpmTasks 'grunt-contrib-coffee'
  grunt.loadNpmTasks 'grunt-connect-proxy'
  grunt.loadNpmTasks 'grunt-rails-server'
#于2014-11-05使用发电机角度0.9.8生成
“严格使用”
##全球化
#出于性能原因,我们只降低了一个级别:
#'test/spec/{,*/}*.js'
#如果要递归匹配所有子文件夹,请使用此选项:
#“test/spec/***.js”
module.exports=(咕噜)->
#自动加载grunt任务
需要('load-grunt-tasks')grunt
#时间-任务需要多长时间。可以帮助优化构建时间
需要('time-grunt')咕哝
#应用程序的可配置路径
appConfig=
app:require('./bower.json').appPath或'app'
地区:“../public”
modRewrite=require('connect-modRewrite')
#定义所有任务的配置
grunt.initConfig
约曼:appConfig
观察:
鲍尔:
文件:['bower.json']
任务:['wiredep']
js:
文件:['/scripts/{,*/}*.js']
任务:['newer:jshint:all']
选项:livereload:'
玉:
文件:['/**.jade'],
任务:['jade']
咖啡:
文件:['/scripts/{,*/}*{coffee,litcoffee,coffee.md}']
任务:['newer:coffee:dist']
jsTest:
文件:['test/spec/{,*/}*.js']
任务:[
'更新:jshint:test'
“因果报应”
]
指南针:
文件:['/styles/{,*/}*{scss,sass}']
任务:[
“指南针:服务器”
“自动刷新器”
]
GrunFile:文件:['grunfile.js']
利弗雷罗德:
选项:livereload:'
档案:[
“.tmp/{,*/}*.html”
“.tmp/styles/{,*/}*.css”
“/images/{,*/}*{png,jpg,jpeg,gif,webp,svg}”
]
连接:
选项:
港口:9000
主机名:“localhost”
利弗雷罗德:35729
代理人:[{
上下文:'/api'
主机:“localhost”
港口:3000
} ]
livereload:选项:
开放:是的
中间件:(连接,选项)->
如果!Array.isArray(options.base)
options.base=[options.base]
中间商=[
modRewrite(['!/api |/assets |\\..+$/index.html']))
require('grunt-connect-proxy/lib/utils')。proxyRequest
connect.static(“.tmp”)
connect().使用('/bower\u components',connect.static('/bower\u components'))
connect.static(appConfig.app)
]
#使目录可浏览。
directory=options.directory或options.base[options.base.length-1]
middleware.push connect.directory(目录)
中间件
测试:选项:
港口:9001
中间件:(连接)->
[
connect.static(“.tmp”)
connect.static('test')
connect().使用('/bower\u components',connect.static('/bower\u components'))
connect.static(appConfig.app)
]
地区:选项:
开放:是的
基:“”
jshint:
选项:
jshintrc:“.jshintrc”
记者:require('jshint-style')
全部:src:[
“Gruntfile.js”
“/scripts/{,*/}*.js”
]
测试:
选项:jshintrc:'test/.jshintrc'
src:['test/spec/{,*/}*.js']
清洁:
地区:文件:[{
多特:是的
src:[
“.tmp”
'/{,*/}*'
“!/.git*”
]
} ]
服务器:'.tmp'
自动刷新器:
选项:浏览器:[“上一版本”]
地区:文件:[{
扩展:正确
cwd:“.tmp/styles/”
src:“{,*/}*.css”
目标:'.tmp/styles/'
} ]
wiredep:
应用程序:
src:['/index.jade']
忽略路径:/\.\\//
sass:
src:['/styles/{,*/}*{scss,sass}']
ignorePath:/(\.\.\/){1,2}bower\u组件\//
玉:
地区:
选项:
真的吗
数据:
调试:正确
档案:[
扩展:正确
cwd:'
目标:'.tmp'
src:“***.jade”
分机:'.html'
]
咖啡:
选项:
sourceMap:true
是的
sourceRoot:“”
地区:
档案:[
扩展:正确
cwd:“/scripts”
src:“{,*/}*.coffee”
目标:'.tmp/scripts'
分机:'.js'
]
测试:
档案:[
扩展:正确
cwd:“测试/规范”
src:“{,*/}*.coffee”
目标:'.tmp/spec'
分机:'.js'
]
指南针:
选项: