首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >咕噜表不停地注视着无限

咕噜表不停地注视着无限
EN

Stack Overflow用户
提问于 2014-12-27 22:50:09
回答 1查看 119关注 0票数 0

嗨,我用Grunt把我的较少的代码编译成CSS。要查看是否对我的.less文件进行了更改,请使用:

代码语言:javascript
复制
grunt watch

在这样做之后,我编辑了我的.less文件。但是在cmd中什么都没有发生,我仍然看到他在监视我的.less文件。下面是它的截图:

链接:http://i.imgur.com/hT8l18f.png

下面是我使用的代码:

gruntfile.js:

代码语言:javascript
复制
module.exports = function(grunt) {

  grunt.initConfig({
    less: {
      development: {
        options: {
          compress: true,
          yuicompress: true,
          optimization: 2
        },
        files: {
          "css/styles.css": "css/styles.less" // destination file and source file
        }
      }
    },
    watch: {
      styles: {
        files: ['less/styles.less'], // which files to watch
        tasks: ['less'],
        options: {
          nospawn: true
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['less', 'watch']);
};

package.json:

代码语言:javascript
复制
{
  "name": "Coming_soon_code",
  "version": "0.0.0",
  "description": "van een tut",
  "main": "gruntfile.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "BSD-2-Clause",
  "devDependencies": {
    "grunt": "~0.4.5",
    "grunt-contrib-less": "~1.0.0",
    "grunt-contrib-watch": "~0.6.1"
  }
}

这里还有我的文件夹结构的屏幕截图,如果您需要的话:

链接:http://i.imgur.com/WWAJZb0.png

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-12-27 23:13:48

你似乎在“看”'less/styles.less'文件.但根据屏幕截图或less任务配置,这不是正确的目录,而是在css目录中。也许试一试:

代码语言:javascript
复制
watch: {
  styles: {
    files: ['css/styles.less'], // <-- changed the directory here...
    tasks: ['less'],
    options: {
      nospawn: true
    }
  }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27672190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档