繁体   English   中英

在gruntfile.js中设置玉器

[英]setting up jade in gruntfile.js

所以我试图在我的应用程序中设置玉器,当我做一个咕unt声时,我得到一个

运行“ postcss:dist”(postcss)任务

已创建1个处理过的样式表。 找不到“ concat”目标。 警告:任务“ concat”失败。 使用--force继续。

我的代码有什么问题吗?

在此处输入图片说明

 // Generated on 2015-10-30 using // generator-webapp 1.1.0 'use strict'; // # Globbing // for performance reasons we're only matching one level down: // 'test/spec/{,*/}*.js' // If you want to recursively match all subfolders, use: // 'test/spec/**/*.js' module.exports = function (grunt) { // Time how long tasks take. Can help when optimizing build times require('time-grunt')(grunt); // Automatically load required grunt tasks require('jit-grunt')(grunt, { useminPrepare: 'grunt-usemin' }); // Configurable paths var config = { app: 'app', dist: 'dist' }; // Define the configuration for all the tasks grunt.initConfig({ // Project settings config: config, // Watches files for changes and runs tasks based on the changed files watch: { bower: { files: ['bower.json'], tasks: ['wiredep'] }, babel: { files: ['<%= config.app %>/scripts/{,*/}*.js'], tasks: ['babel:dist'] }, babelTest: { files: ['test/spec/{,*/}*.js'], tasks: ['babel:test', 'test:watch'] }, gruntfile: { files: ['Gruntfile.js'] }, jade: { files: ['<%= config.app %>/{,*/}*.jade'], tasks: ['jade'] }, sass: { files: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'], tasks: ['sass', 'postcss'] }, styles: { files: ['<%= config.app %>/styles/{,*/}*.css'], tasks: ['newer:copy:styles', 'postcss'] } }, browserSync: { options: { notify: false, background: true, watchOptions: { ignored: '' } }, livereload: { options: { files: [ '.tmp/{,*/}*.html', '.tmp/styles/{,*/}*.css', '<%= config.app %>/images/{,*/}*', '.tmp/scripts/{,*/}*.js' ], port: 9000, server: { baseDir: ['.tmp', config.app], routes: { '/bower_components': './bower_components' } } } }, test: { options: { port: 9001, open: false, logLevel: 'silent', host: 'localhost', server: { baseDir: ['.tmp', './test', config.app], routes: { '/bower_components': './bower_components' } } } }, dist: { options: { background: false, server: '<%= config.dist %>' } } }, // Empties folders to start fresh clean: { dist: { files: [{ dot: true, src: [ '.tmp', '<%= config.dist %>/*', '!<%= config.dist %>/.git*' ] }] }, server: '.tmp' }, // Make sure code styles are up to par and there are no obvious mistakes eslint: { target: [ 'Gruntfile.js', '<%= config.app %>/scripts/{,*/}*.js', '!<%= config.app %>/scripts/vendor/*', 'test/spec/{,*/}*.js' ] }, // Mocha testing framework configuration options mocha: { all: { options: { run: true, urls: ['http://<%= browserSync.test.options.host %>:<%= browserSync.test.options.port %>/index.html'] } } }, // Compiles ES6 with Babel babel: { options: { sourceMap: true }, dist: { files: [{ expand: true, cwd: '<%= config.app %>/scripts', src: '{,*/}*.js', dest: '.tmp/scripts', ext: '.js' }] }, test: { files: [{ expand: true, cwd: 'test/spec', src: '{,*/}*.js', dest: '.tmp/spec', ext: '.js' }] } }, jade: { dist: { options: { pretty: true }, files: [{ expand: true, cwd: '<%= config.app %>', dest: '.tmp', src: '*.jade', ext: '.html' }] } }, // Compiles Sass to CSS and generates necessary files if requested sass: { options: { sourceMap: true, sourceMapEmbed: true, sourceMapContents: true, includePaths: ['.'] }, dist: { files: [{ expand: true, cwd: '<%= config.app %>/styles', src: ['*.{scss,sass}'], dest: '.tmp/styles', ext: '.css' }] } }, postcss: { options: { map: true, processors: [ // Add vendor prefixed styles require('autoprefixer')({ browsers: ['> 1%', 'last 2 versions', 'Firefox ESR'] }) ] }, dist: { files: [{ expand: true, cwd: '.tmp/styles/', src: '{,*/}*.css', dest: '.tmp/styles/' }] } }, // Automatically inject Bower components into the HTML file wiredep: { app: { src: ['<%= config.app %>/index.html'], ignorePath: /^(\\.\\.\\/)*\\.\\./ }, sass: { src: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'], ignorePath: /^(\\.\\.\\/)+/ } }, // Renames files for browser caching purposes filerev: { dist: { src: [ '<%= config.dist %>/scripts/{,*/}*.js', '<%= config.dist %>/styles/{,*/}*.css', '<%= config.dist %>/images/{,*/}*.*', '<%= config.dist %>/styles/fonts/{,*/}*.*', '<%= config.dist %>/*.{ico,png}' ] } }, // Reads HTML for usemin blocks to enable smart builds that automatically // concat, minify and revision files. Creates configurations in memory so // additional tasks can operate on them useminPrepare: { options: { dest: '<%= config.dist %>' }, html: '.tmp/index.html' }, // Performs rewrites based on rev and the useminPrepare configuration usemin: { options: { assetsDirs: [ '<%= config.dist %>', '<%= config.dist %>/images', '<%= config.dist %>/styles' ] }, html: ['<%= config.dist %>/{,*/}*.html'], css: ['<%= config.dist %>/styles/{,*/}*.css'] }, // The following *-min tasks produce minified files in the dist folder imagemin: { dist: { files: [{ expand: true, cwd: '<%= config.app %>/images', src: '{,*/}*.{gif,jpeg,jpg,png}', dest: '<%= config.dist %>/images' }] } }, svgmin: { dist: { files: [{ expand: true, cwd: '<%= config.app %>/images', src: '{,*/}*.svg', dest: '<%= config.dist %>/images' }] } }, htmlmin: { dist: { options: { collapseBooleanAttributes: true, collapseWhitespace: true, conservativeCollapse: true, removeAttributeQuotes: true, removeCommentsFromCDATA: true, removeEmptyAttributes: true, removeOptionalTags: true, // true would impact styles with attribute selectors removeRedundantAttributes: false, useShortDoctype: true }, files: [{ expand: true, cwd: '.tmp', src: '{,*/}*.html', dest: '<%= config.dist %>' }] } }, // By default, your `index.html`'s <!-- Usemin block --> will take care // of minification. These next options are pre-configured if you do not // wish to use the Usemin blocks. // cssmin: { // dist: { // files: { // '<%= config.dist %>/styles/main.css': [ // '.tmp/styles/{,*/}*.css', // '<%= config.app %>/styles/{,*/}*.css' // ] // } // } // }, // uglify: { // dist: { // files: { // '<%= config.dist %>/scripts/scripts.js': [ // '<%= config.dist %>/scripts/scripts.js' // ] // } // } // }, // concat: { // dist: {} // }, // Copies remaining files to places other tasks can use copy: { dist: { files: [{ expand: true, dot: true, cwd: '<%= config.app %>', dest: '<%= config.dist %>', src: [ '*.{ico,png,txt}', 'images/{,*/}*.webp', '{,*/}*.html', 'styles/fonts/{,*/}*.*' ] }] } }, // Run some tasks in parallel to speed up build process concurrent: { server: [ 'babel:dist', 'sass' ], test: [ 'babel' ], dist: [ 'babel', 'sass', 'imagemin', 'svgmin' ] } }); grunt.registerTask('serve', 'start the server and preview your app', function (target) { if (target === 'dist') { return grunt.task.run(['build', 'browserSync:dist']); } grunt.task.run([ 'clean:server', 'wiredep', 'jade', 'concurrent:server', 'postcss', 'browserSync:livereload', 'watch', ]); }); grunt.registerTask('server', function (target) { if (target === 'dist') { return grunt.task.run(['build', 'open', 'connect:dist:keepalive']); } grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); grunt.task.run([target ? ('serve:' + target) : 'serve']); }); grunt.registerTask('test', function (target) { if (target !== 'watch') { grunt.task.run([ 'clean:server', 'concurrent:test', 'postcss' ]); } grunt.task.run([ 'browserSync:test', 'mocha', 'jade' ]); }); grunt.registerTask('build', [ 'clean:dist', 'wiredep', 'useminPrepare', 'concurrent:dist', 'postcss', 'concat', 'cssmin', 'uglify', 'copy:dist', 'filerev', 'usemin', 'htmlmin', 'jade', ]); grunt.loadNpmTasks('grunt-contrib-jade',[ ]); grunt.registerTask('default', [ 'newer:eslint', 'test', 'build' ]); }; 

因此,事实证明我把grunt.registerTask的安排弄错了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM