Tag: gruntjs

grunt-newer将无法正常使用Watchify

我用一堆软件包来使用Grunt for Node 。 例如jsHint , jsDoc , Browserify , Uglify … 我使用Watchify和更新的Gruntfile来运行自动化。 到现在为止还挺好。 Gruntfile,工作总是很好: module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jshint: { all: ['my/js/files/*.js'] }, jsdoc : { dist : { src: ['my/js/files/*.js'], options: { destination: 'doc' } } }, browserify: { 'public/js/files/script.js': ['my/js/files/*.js'] }, uglify: { my_target: { files: { 'public/js/files/script.js': ['public/js/files/script.js'] […]

Grunt-contrib-watch用grunt-contrib-connect

不幸的是, grunt-contrib-watch和grunt-contrib-connect似乎并不好。 在grunt-contrib-connect 自述文件中说: 请注意,此服务器只在运行grunt时才运行。 一旦咕噜的任务完成,Web服务器停止。 这种行为可以通过Keepalive选项来改变,并且可以通过运行像grunt connect :: keepalive这样的任务来启用ad-hoc。 精细。 但是如果我想与连接服务器一起运行我的监视任务呢? 像这样: connect: { server: { options: { port: 8000, hostname: 'localhost', keepalive: true } } }, watch: { options: { livereload: true }, files: ['**'], tasks: ['connect'], } 这里, connect任务在文件改变时运行。 如果我将connect的keepalive选项设置为true,那么grunt-contrib-watch会停止监视,因为它在技术上还没有完成任务。 如果我伪造keepalive选项,那么连接服务器在完成任务后就会死亡。 是的,我可以运行命令… $ grunt connect $ grunt watch …在单独的shell中,但没有办法用一个命令来运行它们吗?

grunt-contrib-watch livereload 35729 livereload.js无法加载

我正在运行grunt-contrib-watch 0.6.1,并在我的gruntfile.js中包含了livereload块。 我还在我的html中包含了livereload.js调用: <script type="text/javascript" src="http://myste.com:35729/livereload.js"></script> 当我使用我的开发环境运行服务器似乎一切似乎开始正确。 grunt dev Running "env:dev" (env) task Running "concurrent:dev" (concurrent) task Running "nodemon:dev" (nodemon) task [nodemon] v1.2.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching: *.* [nodemon] starting `node server.js` Application Started on port 3000 当我进行更改时,可以看到服务器在我的ssh控制台中重新加载,但livereload.js无法加载: 当我去的应该是http://myste.com:35729/livereload.js的端口位置,我得到的标准“网页不可用”的回应。 在http://myste.com:35729/上似乎也没有运行服务器。 我也包括我的gruntfile.js完整性 'use strict'; module.exports = function (grunt) { var […]

Tomcat,Grunt构build

我正在使用我的angularjs应用程序和tomcat服务器端的咕噜声。 无论何时需要,在开发环境,我运行Grunt生成,采取dist文件夹,并把它放在tomcat webapp文件夹中。 但是,我有一个奇怪的问题。 只有当我从HTML页面点击它们时,应用程序中的URL才能起作用。 例如,如果我inputhttp://localhost:8080/upload – 我将得到404 page not found error ,但是如果从索引页 – http://localhost:8080 ,我点击页面上的链接,导致上传它的作品精细。 可能是什么问题呢? 如果我运行node.js上的应用程序,链接工作完美! 只是在Tomcat上它不能按预期工作。 EDITED 我用angular度js来定义这样的url angular.module('angularjsApp') .config(function ($stateProvider) { $stateProvider .state('upload', { url: '/upload', templateUrl: 'app/upload/upload.html', controller: 'UploadCtrl' }); });

使用Grunt时,是否需要使用“./”作为path?

我简单地用“./path/to/resource”replace“path / to / resource”来解决一个问题。 这很重要吗? concat: { css: { src: [ 'public/css/datepicker.css', 'public/css/jquery.tagsinput.css', './src/css/sass_styles.css', // << previously 'src/css/sass_styles.css' 'application/themes/japantravel/style.css' ], dest: './public/css/all.css', }, options: { process: function(src, filepath) { return "/* #### FILENAME: " + filepath + " #### */\n\n" + src + "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; } } }, 使用“./”前缀更好吗? 为什么会这样? 我以为两条路都是一样的

量angular器 – 节点 – 连接

我对标题中提到的所有概念都很陌生,我试图理解它们之间的联系以及它们各自负责的内容。 我当然知道量angular器是e2etesting的angular度,但我明白,我可以运行它 $ protractor congif.js 我也可以通过调用它来运行它 node protractor….something 正如我所说 – 我很困惑,如果有人能解释不同的方法和一些背景(或指导我的具体教程)将是很好的。 谢谢!

用grunt闭包编译器生成源图?

有没有办法用grunt闭包编译器生成源映射? 我尝试了grunt-closure-compiler和grunt-closure-tools,但似乎无法得到它来生成源映射文件。 这是我的设置: 在这里我尝试了内部options和外部options ,都使用true或path/to/src.map 。 我无法find这个文件。 'closure-compiler': { lib : { closurePath: 'closure-compiler', js: 'path/to/src.js', jsOutputFile: 'path/to/output.js', maxBuffer: 10000, // sourceMap: true / 'path/to/src.map' options: { compilation_level: 'ADVANCED_OPTIMIZATIONS', language_in: 'ECMASCRIPT5', externs: ['externs/*.js'], // sourceMap: true / 'path/to/src.map' } } }, 在这里我跟着文档,但不能得到它的工作。 closureCompiler: { options: { compilerFile: 'closure-compiler/build/compiler.jar', create_source_map: 'path/to/src.map', compilation_level: 'ADVANCED_OPTIMIZATIONS', externs: ['externs/*.js'] }, […]

你如何debuggingnodejs项目?

在过去16个小时左右,我一直在试图在我的电脑上运行一个MEAN堆栈项目。 我从Yeoman的angular度全面项目开始 。 但那是给了我各种各样的错误,所以我就放弃了。 然后我跟着一些帮助我开始的教程,但没有涉及到我的问题。 然后,我发现mean.io提供了一个完整的样板MEAN堆栈项目,我按照说明来设置。 不幸的是,当我尝试运行它时,我再次遇到各种错误:-( 最糟糕的是,它没有说什么/在哪里造成的错误。 有人能帮我弄明白吗? 请 :-) 我得到的最新错误是当我运行grunt 。 C:\Users\Imray\projects Practice\meanIO\meanApp>grunt Running "hook" task >> Starting hooked tasks. Running "clean:0" (clean) task >> 0 paths cleaned. Running "jshint:all" (jshint) task >> 42 files lint free. Running "csslint:src" (csslint) task >> 5 files lint free. Running "concurrent:tasks" (concurrent) task Running "watch" task […]

任务“阻塞”对方

我在Grunt中发现了一个奇怪的行为,它似乎是两个任务彼此阻塞(或类似的东西)。 任务是:shell( https://github.com/sindresorhus/grunt-shell )和sass( https://github.com/gruntjs/grunt-contrib-sass )。 我的(减less的)Gruntfile; "use strict"; var path = require('path'); module.exports = function(grunt) { require('time-grunt')(grunt); require('load-grunt-tasks')(grunt); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), shell: { options: { stdout: true, stderr: true }, bower: { command: path.resolve(process.cwd() + '/node_modules/.bin/bower –allow-root install') } }, /* … other tasks */ sass: { dist: { options: { trace: true }, […]

如何从grunt执行节点模块的茉莉花testing

我想在Grunt构build中为node.js模块运行一些Jasmine 2.xtesting。 我的设置看起来像这样: SRC / foo.js exports.bar = 23; 投机/ foo.spec.js var foo = require("../src/foo.js"); define("foo", function() { it("exports bar as 23", function() { expect(foo.bar).toBe(23); }); }); 随着grunt-contrib-jasmine节点模块系统不可用,我得到 >> ReferenceError: Can't find variable: require at >> spec/foo.spec.js:1 有grunt-jasmine-node ,但是依赖于没有维护的jasmine-node ,包括Jasmine 1.3.1,所以这不是一个选项。 Jasmine通过在spec目录中包含一个jasmine.json文件jasmine.json 支持node.js ,我可以用jasmine cli运行testing。 有没有干净的方式来运行从咕噜同样的testing呢?