Search code examples
node.jsgruntjssails.jscompassgrunt-contrib-compass

how can I integrate sails.js with compass?


first excuse my English, I would like to have all the compilation power of compass in sails, compass is able to watch many directories and compile the files that doesn't begin with _, and it creates he same directory structure for the compiled files. how can I do this with grunt or how can I add compass to grunt and let compass compile the files, thanks


Solution

  • sails.js uses grunt for automatic / manual task running. If you need to simplify or automate compass tasks, use grunt-compass .

    Technical Details

    • Create a new file tasks/config/compass.js with contents similar to below

       module.exports = function (grunt) {
          grunt.config.set('compass', {
              src: 'assets/scss/partials',
              dest: 'assets/css/partials'
          });
          grunt.loadTasks('grunt-compass/tasks');
      
        };
    • Then you should be able to run the tasks using grunt compass

    • Edit the tasks/watch.js file and add the compass task alongwith linkAssets task etc if you want to run the task on file changes.