繁体   English   中英

咕and少。 没有找到“更少”的目标?

[英]Grunt and Less. No «less» targets found?

我安装angular-generator使用约曼对我今后的项目中,我打算使用less

我有的:

npm install grunt-contrib-less --save-dev

Gruntfile.js

watch: {
            tests: '<%= nodeunit.tests %>',
            tasks: 'default',
            styles: {
                files: ['app/styles/less/*.less'], // which files to watch
                tasks: ['less']
            }
        },
less: {
            development: {
                options: {
                    paths: ["app/styles/less"],
                    yuicompress: true
                },
                files: {
                    // target.css file: source.less file
                    "app/styles/main.css": "app/styles/less/main.less"
                }
            }
        },

grunt.loadNpmTasks('grunt-contrib-less');

grunt.registerTask('default', ['jshint', 'clean', 'copy', 'useminPrepare', 'ngtemplates', 'concat', 'uglify', 'cssmin', 'usemin', 'nodeunit', 'less']);

少运行咕unt声后,我出现此错误:

>> No "less" targets found.
Warning: Task "less" failed. Use --force to continue.

我该如何解决?

不知道您所说的是什么,但我正在使用以下内容,并且可以正常工作:

watch {
  ..,
  less: {
    files: ['<%= config.app %>/styles/{,*/}*.less'],
    tasks: ['less']
  },
},

....

less: {
  production: {
    options: {
      paths: ['dist/styles'],
      cleancss: false
    },
    files: {
      '.tmp/styles/main.css': 'app/styles/main.less'
    }
  }
},

暂无
暂无

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

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