grunt-contrib-watch

Codeigniter and React.JS setup

点点圈 提交于 2019-12-19 03:32: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 回答1: 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

How to modify grunt watch tasks based on the file changed?

给你一囗甜甜゛ 提交于 2019-12-17 19:07:05
问题 I'm writing a node.js program that will watch a directory filled with a large (300-ish) amount of scss projects. Grunt-watch (run either through the node module or on its own, whatever works) will be configured so that whenever a scss file is changed, it will be compiled with compass, the output file moved to a separate directory, for example: ./1234/style.scss was changed >> grunt-watch runs grunt-compass >> /foo/bar/baz/1234/style.css updated The project directory that the file was in is

Grunt Exiting When It Should Be Watching

雨燕双飞 提交于 2019-12-13 04:02:09
问题 I am developing a node app that interacts with IRC. My Gruntfile.js : module.exports = function(grunt) { grunt.initConfig({ watch: { js: { files: [ 'index.js', 'brains.js', 'lib/*.js' ], tasks: ['develop'], options: { nospawn: true } } }, develop: { server: { file: 'index.js' } } }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-develop'); grunt.registerTask('default', ['develop']); }; When I execute grunt it states that it completed and exits. How can I keep grunt

grunt-contrib-watch slow even with spawn = false

核能气质少年 提交于 2019-12-13 01:28:12
问题 I have set up the grunt-contrib-watch task to copy a list of files to a "dist" directory every time I save one of the files of the "src" directory. Unfortunately it takes 7 to 9 seconds to accomplish this task. I have heard about the "spawn" option for grunt-contrib-watch. Using load-grunt-tasks to load the config of each task from a separate JSON file, I changed my watch.json so that it looks like this : { "service": { "files": [ "src/*.php" ], "tasks": [ "copy:service" ], "options": {

Grunt watch less on changed file only

↘锁芯ラ 提交于 2019-12-12 18:11:23
问题 I want to have a gruntfile with 2 tasks: less (compiles all less files) and watch (listens to changes and re-compiles the changed file). I have the following Gruntfile.js: module.exports = function(grunt) { var files = [ { expand: true, cwd: 'media/less', src: ['*.less'], dest: 'media/css/', ext: '.css' }, { expand: true, cwd: 'media/less/vendor', src: ['*.less'], dest: 'media/css/vendor/', ext: '.css' }, { expand: true, cwd: 'media/admin/less', src: ['*.less'], dest: 'media/admin/css/', ext:

Grunt watch tasks seem to take a very long time

本小妞迷上赌 提交于 2019-12-12 10:36:42
问题 I'm running two simple tasks that run for <100ms each but when run under the watch command the two combined tasks are taking ~8 seconds in total (there seems to be an overhead of 3.5 seconds per task). I'm using it with live-reload for development and I'm finding it very frustrating. I tried setting spawn to false but this seemed to break it and none of the associated tasks were run. Here's sample output from when a sass file is changed. >> File "app/styles/main.scss" changed. File "app

Grunt with Compass and Watch compiles slow

一世执手 提交于 2019-12-12 07:50:09
问题 Grunt takes a quite long to compile the css file, I am not sure if this is normal but regular compass watch takes around 5 seconds. So the question is if there is any way to speed up the compilation time with Grunt or is it better to just stick with compass watch? Running "compass:dist" (compass) task ♀unchanged images/sprite-sf580a96666.png overwrite stylesheets/app.css (3.263s) unchanged images/sprite-sf580a96666.png overwrite stylesheets/app_fr.css (3.289s) Compilation took 11.116s Running

Parameters binding in grunt tasks

坚强是说给别人听的谎言 提交于 2019-12-12 02:56:02
问题 I have problem with grunt tasks: watch: { jshint: { files: ['Gruntfile.js', '<%= version %>/src/**/*.js', '<%= version %>/src/*.js'], tasks: ['jshint', 'concat', 'uglify'], options: { livereload: true } } }, I call it in a function grunt.registerTask('server', 'A task that runs server', function(version) { if (arguments.length === 0) { grunt.log.writeln("Please specify Version in arguments (grunt "+this.name+":version)"); } else { grunt.log.writeln(this.name + ", " + version ); grunt.config

grunt-contrib-less: compilation on watch task removes sourcemap link

醉酒当歌 提交于 2019-12-12 01:39:53
问题 Here's my less task config: less: { development: { options: { compress: false, sourceMap: true, yuicompress: true, sourceMapFilename: 'export/style/app.css.map', sourceMapURL: '/style/app.css.map' }, files: { "export/style/app.css": "less/app.less" } } }, If I just type grunt less , in my compiled file i get the /*# sourceMappingURL=/style/app.css.map */ comment correctly. Instead, when i run grunt and my watch task kicks in, the /*# sourceMappingURL=/style/app.css.map */ comment is removed

Prevent `grunt-watch` from looping when there is a syntax error in less files?

不打扰是莪最后的温柔 提交于 2019-12-11 20:23:05
问题 I'm using grunt-watch to re-build my less style sheets: watch: { less: { files: ['media/less/**/*.less'], tasks: ['less'], options: { atBegin: true, spawn: false } } } But if there is a syntax error in any of the .less files, the task just loops, trying to re-build the .less files every second… which makes debugging fairly difficult, because the error messages scroll past very quickly. Is there any way fix that, so grunt-watch will only re-run the task once the .less files have been changed