grunt-contrib-watch

How to setup Gruntfile.js to watch for SASS (compass) and JS

烈酒焚心 提交于 2019-12-01 18:14:43
问题 I'm new to using gruntjs and nodejs. I wanted to know how can I setup the gruntfile so that it watches both the sass files and the js files compiles using watch. This is what I have so far: module.exports = function ( grunt ) { "use strict"; require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), compass: { dist: { options: { config: 'config.rb', watch: true } } } }); grunt.registerTask('default', []); }; Any help will

Grunt watch: compile only one file not all

大城市里の小女人 提交于 2019-12-01 03:56:54
I have grunt setup to compile all of my coffee files into javascript and maintain all folder structures using dynamic_mappings which works great. coffee: { dynamic_mappings: { files: [{ expand: true, cwd: 'assets/scripts/src/', src: '**/*.coffee', dest: 'assets/scripts/dest/', ext: '.js' }] } } What I would like to do is then use watch to compile any changed coffee file and still maintain folder structure. This works using the above task with this watch task: watch: { coffeescript: { files: 'assets/scripts/src/**/*.coffee', tasks: ['coffee:dynamic_mappings'] } } The problem is that when one

Grunt watch: compile only one file not all

与世无争的帅哥 提交于 2019-12-01 01:39:00
问题 I have grunt setup to compile all of my coffee files into javascript and maintain all folder structures using dynamic_mappings which works great. coffee: { dynamic_mappings: { files: [{ expand: true, cwd: 'assets/scripts/src/', src: '**/*.coffee', dest: 'assets/scripts/dest/', ext: '.js' }] } } What I would like to do is then use watch to compile any changed coffee file and still maintain folder structure. This works using the above task with this watch task: watch: { coffeescript: { files:

Codeigniter and React.JS setup

佐手、 提交于 2019-11-30 21:33:44
Im planning to have Codeigniter and ReactJS for my new project, I need to know how to setup the project folders and the build process for the .jsx files to be .js and then all the .js files to be concatenated and minified to be min.js I'm thinking of using GruntJS Try Gulp instead I might suggest you use gulp instead, it's much more beginner friendly IMO. If I was setting up such a project I might start with a folder structure like this, and install my node_modules. I quite like to use (sass,jade-php,livereload) but these are optional. Folder structure package.json gulpfile.js /application |

Grunt watch detects file changes only after 5 seconds with Vagrant and NFS

牧云@^-^@ 提交于 2019-11-30 05:03:21
Grunt watch (grunt-contrib-watch) is used to trigger reload of web app in browser. However, it is slow to notice file changes when running in a Vagrant virtual machine using NFS for synced folders. Changing a file triggers a reload only after about 5 seconds although it is expected to happen almost instantly. Why is grunt watch so slow to detect changes? Is there any way to make it faster? With VirtualBox synced folders grunt watch detects file changes almost instantly. However, as VirtualBox synced folders are unacceptably slow for certain other operations on large amounts of files it is

Grunt doesn't update main scss file

点点圈 提交于 2019-11-29 20:52:28
问题 I have a project that uses GruntJS with grunt-contrib-sass, grunt-contrib-watch and grunt-newer. My main app.scss file imports a few .scss files with the @import directive like @import "common/vars.scss"; If I make changes in the main app.scss everything works. The problem is that when I make changes in a file that is being imported (like vars.scss), the app.scss doesn't get updated. This is my watch task: watch: { css: { files: ['scss/**/*.scss'], tasks: ['newer:sass'], options: { spawn:

Replace all the text with specified replacement using grunt replace

萝らか妹 提交于 2019-11-29 17:42:45
I have a .html file which contains id="fixedtext", I want to replace all these id with id="uniquetext" the grunt-text-replace just replaces the first id it finds and doesnot parse the entire text. Any idea how can I make either grunt-text-replace https://github.com/yoniholmes/grunt-text-replace or grunt-replace https://www.npmjs.com/package/grunt-replace to do this for the entire document and not just for the first occurrence. replace: { dist: { options:{ patterns:[{ match:'id="fixedtext"', replacement: 'id="'+something[i++] +'"' }], files:[ { expand: true, src:['./source.html'], dest:'./dest

Why does sass fail to compile with grunt command error of “index is 2 but list is only 1 item long for `nth'”?

社会主义新天地 提交于 2019-11-29 17:41:11
After inheriting a project using Grunt, I am running grunt via terminal, waiting for the 'Watching...' make the change to the scss, and terminal recognizes the change but the compilation fails in the next step of compass:dev. Here is what it's showing inside terminal: Waiting... >> File "../sass/inside.scss" changed. Running "compass:dev" (compass) task unchanged ../img/common/1x-scb9effd9a6.png unchanged ../img/common/2x-s7bf9cb0f59.png error /Applications/MAMP/htdocs/Repos/wp-content/themes/quindo/_/sass/inside.scss (Line 39 of /Applications/MAMP/htdocs/Repos/wp-content/themes/quindo/_/sass

Troubles with NPM and node-gyp in Windows

不羁的心 提交于 2019-11-29 08:21:34
I have some troubles with npm packages on my Windows workstation... I have a set of NPM dependencies in my package.json file: "devDependencies": { "babel-plugin-transform-react-jsx": "^6.2.0", "babel-preset-es2015": "^6.1.18", "babel-preset-react": "^6.1.18", "grunt": "^0.4.5", "grunt-babel": "^6.0.0", "grunt-contrib-connect": "^0.11.2", "grunt-contrib-jasmine": "^0.9.2", "grunt-contrib-sass": "^0.9.2", "grunt-contrib-watch": "^0.6.1", "grunt-exec": "^0.4.6", "grunt-template-jasmine-requirejs": "^0.2.3", "karma-chrome-launcher": "^0.2.2", "karma-firefox-launcher": "^0.1.7", "karma-requirejs":

Grunt watch detects file changes only after 5 seconds with Vagrant and NFS

自作多情 提交于 2019-11-29 03:33:36
问题 Grunt watch (grunt-contrib-watch) is used to trigger reload of web app in browser. However, it is slow to notice file changes when running in a Vagrant virtual machine using NFS for synced folders. Changing a file triggers a reload only after about 5 seconds although it is expected to happen almost instantly. Why is grunt watch so slow to detect changes? Is there any way to make it faster? With VirtualBox synced folders grunt watch detects file changes almost instantly. However, as VirtualBox