Tag: grunt contrib watch

GruntJS + contrib-coffee:编译但保持文件夹结构

我用grunt-contrib-coffee使用GruntJS 。 这很好用! 随着Watch插件的帮助,它甚至更好。 但是我怀疑: 我有两个文件夹,其中一个用我的coffeescript文件,另一个用我的(编译的)js文件。 看起来像这样 root_folder |— public |— libs |— ppalmeida <= here are my .js compiled files from src_client coffeescripts |— controllers |— core |— Main.js |— models |— src_client <= here are my .coffee files |— controllers |— core |— Main.coffee |— models 当我使用coffee –output –compile命令构build时,文件夹结构保持不变:Coffeescript cli编译“core”文件夹并在Main.js中。 但是当我运行GruntJS时,它将所有文件放在同一个文件夹(ppalmeida)中。 所以控制器,核心,模型文件被扔在同一个文件夹,女巫我不想要的。 这是我的glob_to_multipleconfiguration: […]

如何从grunt-contrib-watch杀死的进程释放资源?

我试图使用模块grunt-contrib-watch来重新启动我的node.js服务器,每当某些文件更改。 我已经使用grunt运行服务器,jshint和模板编译器,我知道这些函数的工作。 以下是启动服务器的任务: grunt.registerTask('runServer', 'Starts the server.', function(){ grunt.log.writeln('Starting server…'); var done = this.async(); var child = grunt.util.spawn({ cmd: process.argv[0], args: ['server.js'], }, function(){ grunt.log.writeln('Server stopped!'); done(true); }); child.stdout.pipe(process.stdout); child.stderr.pipe(process.stderr); }); 这是watch任务的configuration: watch: { all: { files: ['some/files/*.js'], tasks: ['default'], options: { spawn: true, interrupt: true, reload: true, } } } 当任务重新启动时,服务器由于“EADDRINUSE”exception而失败,我认为这是因为之前的subprocess没有释放它正在使用的端口,这很奇怪 – 我看到“服务器停止! “ […]

在运行grunt watch的时候,它会在运行express服务器任务时抛出警告并中止

在运行grunt watch的时候,它会在运行express服务器任务时抛出警告并中止。 警告如下: Running "express-server:devServer" (express-server) task Warning: Object function createServer() { function app(req, res, next){ app.handle(req, res, next); } merge(app, proto); merge(app, EventEmitter.prototype); app.route = '/'; app.stack = []; return app; } has no method 'static' Use –force to continue. Aborted due to warnings.

停止Grunt Watch破解代码错误

我正在使用grunt-contrib-watch任务。 我想知道是否是阻止观察者破解代码错误的一种方法? 这是为了加快我的工作stream程,因为重启构build和观察任务需要21秒。

Grunt监视任务直到第一个输出到控制台才开始

我的任务configuration工作正常,但我有一个恼人的问题,监视任务不开始监视,除非我刷新页面或添加一行控制台输出。 所以通常我应该得到: Running "watch" task Waiting… 但是直到输出到控制台,我才明白。 这是一个错误? 我的configuration是: module.exports = function(grunt) { grunt.initConfig({ concat: { options: { separator: '\n\n' }, dev: { src: ['ng_app/app.js', 'ng_app/**/*.js'], dest: 'public/js/app.js' } }, less: { dev: { files: [ { expand: true, cwd: 'styles', src: ['*.less', '!mixins.less', '!var.less'], dest: 'public/css/', ext: '.css' }, { expand: true, cwd: 'styles/views', […]

Grunt Watch Task不触发Uglify任务

我在GAMP内部运行一个非常简单的工作stream程,在MAMP中运行。 我正在使用监视任务来触发Sass任务,该任务运行两个子任务(将展开和压缩的样式表放在不同的目录中)以及缩小/连接JavaScript文件。 Sass任务没有问题,但Watch任务不会看到任何JavaScript文件更改来触发Uglify任务。 这是我的Grunt.js文件 module.exports = function(grunt){ grunt.initConfig({ pkg : grunt.file.readJSON('package.json'), //Sass task sass:{ dev: { options: { style: 'expanded', sourcemap: 'none' }, files: { //Destination, Source 'human-readable/style-expanded.css': 'sass/style.scss', 'human-readable/bootstrap-min.css': 'sass/bootstrap.scss' } }, prod:{ options:{ style: 'compressed', sourcemap: 'none' }, files:{ //Destination, Source 'style.css': 'sass/style.scss', 'css/bootstrap.min.css': 'sass/bootstrap.scss' } } }, //Uglify task uglify:{ options:{ mangle: […]

Grunt:Livereload不起作用

每次我尝试使用grunt watch的live reload选项时,我都会遇到这个问题。 无论使用哪个端口,我都会收到“致命错误:端口xxxx已被另一进程使用”。 我列出了所有正在使用的端口,select一个没有出现在列表中的随机数字并没有帮助:它将xxxxreplace为grunt文件中最后使用的任何端口。 我的grunt文件本身: module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), watch: { options: { livereload: true }, js: { files: ['.dev/**/*.js'], tasks: ['concat', 'uglify', 'watch'], }, scss: { files: ['./dev/scss/*.scss'], tasks: ['sass', 'concat', 'watch'], options: { reload: true, livereload: false, } }, html: { files: ['./dev/**/*.html', 'watch'], tasks: ['copy', 'watch'], }, […]

Grunt不加载

请忍受我,因为我是新的节点和咕噜声。 当我运行Grunt使用: Wine-MacBook-JT:sass-test jthomas$ grunt 我得到以下错误: 加载“Gruntfile.js”任务…错误 错误:无法parsing位置248处的JSON中的“package.json”文件(意外的标记)。 警告:找不到任务“默认”。 使用–force继续。 不知道是什么问题。 我的JSON代码是: { "name": "sass-test", "version": "1.0.0", "description": "Simple test project for Grunt and Sass", "main": "Gruntfile.js", "devDependencies": { "grunt": "^0.4.5", "grunt-contrib-sass": "^1.0.0", "grunt-contrib-watch@1.0.0" } } 我的目录结构设置为 ||sass-test ||.sass-cache ||.node-modules SCSS ||_main.scss ||_mixins.scss ||_style.scss Gruntfile.js package.json

configurationgrunt watch使用requirejs对应用程序运行Jasminetesting

为了提高我的通用编码技能,并学习新的东西。 我已经开始尝试连接仅包含前端的解决scheme 迪朗达尔 茉莉花 – [通过npm添加] Grunt Watch监视和运行我的testing,因为我的代码文件更改 – [通过npm添加] 随时纠正我,因为这是根据我在过去两天的实验。 这大部分对我来说都是新的。 我的目标是有什么angular度与业力相似的东西。 现在我意识到,Durandal项目(在github解决scheme中提供了一个自定义的spec runner) 我的设置: gruntfile.js module.exports = function(grunt) { var appPath = 'App/viewmodels/*.js'; var testPath = 'Tests/**/*.js'; grunt.initConfig({ jasmine: { pivotal: { src: appPath, options: { specs: testPath, template: require('grunt-template-jasmine-requirejs'), templateOptions: { requireConfigFile: 'SpecRunner.js' } } } }, jshint: { all: [testPath, appPath], […]

Grunt突然停止工作

试着在我的项目上运行Grunt build和Grunt watch,我遇到了以下错误: Fatal Error: Unable to find local grunt. 我确保文件没有被删除。 我试着重新安装Node和Grunt。 文件在那里,重新安装不起作用。 我已经包含了debugging文件以供参考。 有谁知道这个问题可能是什么? 0 info it worked if it ends with ok 1 verbose cli [ 'E:\\Program Files\\nodejs\\\\node.exe', 1 verbose cli 'E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install' ] 2 info using npm@1.3.24 3 info using node@v0.10.25 4 verbose node symlink E:\Program Files\nodejs\\node.exe 5 […]