为项目设置sass

时间:2015-06-21 20:25:12

标签: node.js sass

我正在尝试设置style.scss文件以输出到style.css中。

我的package.json看起来像这样

{
  "name": "soumghosh",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "grunt-sass": "^1.0.0"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

我的gruntfile.js看起来像这样

module.exports = function(grunt) {
  'use strict';
  grunt.initConfig({
    echo: {
      one: { message: 'one has changed' },
      two: { message: 'two has changed' },
      wait: { message: 'I waited 2s', wait: 2000 },
      interrupt: { message: 'I want to be interrupted', wait: 5000 },
      fail: { fail: 1, message: 'This task should fail', wait: 1000 }
    },
    watch: {
      one: {
        files: ['lib/one.js', 'Gruntfile.js'],
        tasks: 'echo:one',
      },
      two: {
        files: ['lib/two.js'],
        tasks: ['echo:two'],
      },
      wait: {
        files: ['lib/wait.js'],
        tasks: ['echo:wait'],
      },
      interrupt: {
        files: ['lib/interrupt.js'],
        tasks: ['echo:interrupt'],
        options: { interrupt: true },
      },
      fail: {
        files: ['lib/fail.js'],
        tasks: ['echo:fail'],
      },
    },
  });
  // Load the echo task
  grunt.loadTasks('../tasks');
  // Load this watch task
  grunt.loadTasks('../../../tasks');
  grunt.registerTask('default', ['echo']);
};

我想我的困惑是如何启动进程以查看特定目录以编译scss文件。我应该在终端上做一些事情来启动脚本吗?我对节点很新,这就是为什么我对此有点困惑。

0 个答案:

没有答案