A
A
Alexander2014-07-22 12:45:46
Grunt.js
Alexander, 2014-07-22 12:45:46

What's wrong with gruntfile.js?

I started to learn grunt, but so far without much success. When compiling stylus to css, the semicolons at the last properties disappear.
For example:

nav a:hover
  color #DF4A38

compiles to
nav a:hover {
color: #df4a38
}

And watch does not work with livereload when changing properties in the * .styl file.
Here is the gruntfile:
module.exports = function (grunt) {
  grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),

stylus: {
  compile: {  
    options: {
      paths: ['styles/'],
      compress: true
    },
    files: {
     'styles/css/main.css' : 'styles/main.styl' 
    }
  }
},

watch: {
  stylus: {
    files: ['styles/*.styl'],
    tasks: ['stylus'],
  },
  livereload: {
    options: { livereload: true },
    files: ['**/*'],
  }
}
});
  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['stylus', 'autoprefixer','watch']);
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zooks, 2014-07-22
@zooks

Something like that:

watch: {
      options: { livereload: true },
      scripts: {
        files: ['_/js/*.js'],
        tasks: ['uglify']
      }, 
      stylus: {
        files: ['_/stylus/*.styl'],
        tasks: ['stylus']
      }
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question