Tag: gruntjs

防止服务文件,直到咕噜完成

我有几个任务需要花费一些时间:连接,然后uglifying。 最终结果然后由sails链接器用来更新我的布局。 有没有办法阻止访问任何页面之前,这些任务完成咕噜声? 显示一个自定义页面可能? 谢谢

Grunt观看JS或CSS没有运行的任务

我不知道为什么我的grunt-watch没有运行JS或CSSconfiguration 我的Grunt文件位于“工具”文件夹中。 项目文件夹结构如下所示: -index.html -js -css -tools –package.json –node modules –gruntfile.js 这是我的CSS文件夹结构: -css –src —styles.css —third-party —-bootstrap.css 这里是我的JS文件夹结构: -js –src —app.js —third-party —-jquery.js 这是我的package.json { "name": "my-project-name", "version": "0.1.0", "devDependencies": { "grunt": "~0.4.5", "grunt-contrib-cssmin": "^0.10.0", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-uglify": "~0.5.0", "grunt-contrib-watch": "^0.6.1", "matchdep": "^0.3.0" } } 这是我的gruntfile,它是似乎不工作的手表任务: module.exports = function(grunt){ //Loads the necessary tasks for this […]

咕噜声 – 是否有可能只有一次运行的任务?

有一个特殊的任务,我只想运行一次,然后保证它永远不会再运行。 有没有人做过这个? 我正在考虑使用grunt.event.once(…),或者在postinstall上使用shell脚本检测文件夹或文件,但是这两种方式都会在gruntfile.js中留下任何可能随时被覆盖的任务文件。 在一个非常简单的层面上,它会做这样的事情: grunt.registerTask('setup', [ 'mkdir' // run some setup tasks ]); grunt.event.once('setup', function() { // some how do what's below here so it can't be done again // so not available in config for reuse and possibly overwriting // modified files grunt.task.run([ 'bowercopy:src_codeigniter' ]); }); 这甚至可能在Grunt? 我知道这只是一个任务跑步者,在这种情况下,我只是想让它跑一次。

在Windows 8上'npm我'错误

我尝试安装包。 在Windows 7上它工作得很好,但在Windows 8上我得到了: 0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe', 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'i' ] 2 info using npm@1.4.14 3 info using node@v0.10.29 4 verbose node symlink C:\Program Files\nodejs\\node.exe 5 verbose readDependencies using package.json deps 6 verbose install where, deps [ […]

Grunt开发EADDRINUSE

这是我的Gruntfile: module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), watch: { serve: { files: ['server.js', 'src/**/*.coffee'], tasks: ['coffee', 'develop'], options: { nospawn: true } }, css: { files: ['lib/less/main.less'], tasks: ['less'], options: { nospawn: true } }, test: { … } }, jasmine_node: { … }, develop: { server: { file: 'server.js' } }, coffee: { […]

如何使NODEjs中的类名丑化

如果你在这里查看谷歌加源代码,所有的类名都像“Wa4 eR3 …” 我该怎么做呢 ? 谢谢

Grunt:观察文件更改并编译父目录

我正在使用grunt来处理一个项目,我之前没有使用过grunt,现在已经设置为监视文件,当文件已被更改时,使用handleb将所有文件(包含数百个文件的多个子目录)重新编译为html这很慢。 我想通过编译需要的东西来提高速度。 用grunt newer来看文件并不是真正的工作,因为目录中有依赖关系,因此只有重新编译已更改的文件才会生成有效的页面。 我基本上需要重新编译已经改变的文件的整个父目录,但我不太确定如何configuration这样的东西。 任何提示,我应该看看? 汇编本身是这样configuration的: var _ = require('lodash'); var path = require('path'); // expand the data files and loop over each filepath var pages = _.flatten(_.map(grunt.file.expand('./src/**/*.json'), function(filepath) { // read in the data file var data = grunt.file.readJSON(filepath); var dest=path.dirname(filepath)+ '/' +path.basename(filepath, path.extname(filepath)); dest=dest.replace("src/",""); var hbs; if (data.hbs){ hbs=grunt.file.read(path.dirname(filepath)+ '/' + data.hbs) […]

如何使用Grunt或Node服务器基于User-Agent(移动和桌面)redirect请求/代理?

我正在使用Grunt及其代理库grunt-connect-proxy 。 我有两台服务器设置为我的网站的桌面和移动版本(两者都有单独的资产等,因此分离)。 这两个网站都托pipe在0.0.0.0,但在不同的端口(9000和10000)。 我怎么能代理请求到两个不同的服务器基于User-Agent头(这将告诉我,如果它是一个移动或桌面用户)? NodeJS中有另一种解决scheme可以使用吗?

节点检查器不会爆炸对象属性

从昨天我用grunt-node-inspector面对一个奇怪的行为。 当我debugging我的应用程序,我被用来设置断点和观察expression式,然后如果我看的variables是一个数组或对象,我可以点击灰色箭头查看属性(或数组中的元素)。 现在,如果我点击那个箭头,什么都没发生 我没有更新任何东西,所以我不明白为什么检查员开始这样做。 node版本是: v0.10.31 grunt-node-inspector是0.1.5 node-inspector是0.7.4 任何想法如何解决这个问题?

使用NodeJS群集执行Grunt任务

我有一个Grunt任务,目前我正在使用AsyncJS来运行它。 AsyncJS运行良好,但是如果我可以利用NodeJS集群来运行,我觉得它可以更强大。 我已经检出了Grunt Parallel和Grunt Concurrent,并且和我在Grunt任务中做的事情没什么两样。 任何关于利用NodeJS集群模块加快任务执行的build议。 目前我正在这样做 var queue = async.queue(task, function(task, cb){ // Process task with PhantomJS and then cb(); }, require('os').cpus().length); async.each(htmlPages, function(val, cb) { queue.push(val, function() { cb(); }); }, function() { console.log('Completed'); done(); }); 我怎样才能使这个工作与NodeJS集群?