curl https://raw.github.com/creationix/nvm/master/install.sh | sh source ~/.nvm/nvm.sh nvm install 0.10 nvm use 0.10 npm install -g express npm install -g grunt-cli express develop -e cd develop app.engine('html', require('ejs').renderFile); npm install grunt-contrib-watch grunt-contrib-sass grunt-contrib-compass grunt-contrib-coffee grunt-contrib-haml grunt-express-server --save-dev npm install touch Gruntfile.js module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), // }); // grunt.loadNpmTasks(''); // - grunt.registerTask('default', ['']); }; grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-haml'); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-compass'); grunt.loadNpmTasks('grunt-contrib-coffee'); grunt.loadNpmTasks('grunt-express-server'); touch public/javascripts/x.coffee touch public/stylesheets/s.scss touch views/index.haml rm views/index.ejs haml : { dist: { files: { 'views/index.html': 'views/index.haml' } } }, sass : { dist: { files: { 'public/stylesheets/s.css': 'public/stylesheets/s.scss' } } }, coffee : { compile: { files: { 'public/javascripts/x.js': ['public/javascripts/*.coffee'] } } } compass: { dev: { options: { sassDir: ['public/stylesheets'], cssDir: ['public/stylesheets'], environment: 'development' } } }, grunt.registerTask('default', ['sass', 'coffee', 'haml']); grunt and see that the tasks have been successfully executed, and in the corresponding folders you can now find index.html, s.css and x.js. module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), // watch : { haml : { files : 'views/*.haml', tasks : 'haml' }, coffee : { files : 'public/javascripts/*.coffee', tasks : 'coffee' }, sass : { files : 'public/stylesheets/*.scss', tasks : 'sass' }, // compass : { // files: ['public/stylesheets/*.{scss,sass}'], // tasks: ['compass'] // } }, express : { dev: { options: { script: 'app.js' } } }, haml : { dist: { files: { 'views/index.html': 'views/index.haml' } } }, sass : { dist: { files: { 'public/stylesheets/s.css': 'public/stylesheets/s.scss' } } }, compass: { dev: { options: { sassDir: ['public/stylesheets'], cssDir: ['public/stylesheets'], environment: 'development' } } }, coffee : { compile: { files: { 'public/javascripts/x.js': ['public/javascripts/*.coffee'] } } } }); // grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-haml'); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-compass'); grunt.loadNpmTasks('grunt-contrib-coffee'); grunt.loadNpmTasks('grunt-express-server'); // - grunt.registerTask('default', ['sass', 'coffee', 'haml', 'express', 'watch']); }; grunt you can run our application, and all the necessary files will be compiled when the source is changed. watch : { options: { livereload: true, nospawn: true }, haml : { files : 'views/*.haml', tasks : 'haml' }, coffee : { files : 'public/javascripts/*.coffee', tasks : 'coffee' }, // sass : { // files : 'public/stylesheets/*.scss', // tasks : 'sass' // }, compass: { files: ['public/stylesheets/*.{scss,sass}'], tasks: ['compass'] } } %script{src:"//localhost:35729/livereload.js"} Source: https://habr.com/ru/post/215651/
All Articles