Tag: gruntjs

grunt serve:并发:服务器由于警告而中止

突然我的项目停止工作与咕噜声。 不幸的是,我还没有把我的修改变成git,所以我不知道有什么不同。 当我运行grunt server –verbose ,我得到以下输出(上面的所有内容…传递一个OK ): … Running "wiredep" task Running "wiredep:app" (wiredep) task Verifying property wiredep.app exists in config…OK Files: app/index.html Verifying property wiredep.app.src exists in config…OK Running "wiredep:sass" (wiredep) task Verifying property wiredep.sass exists in config…OK Files: app/styles/analyzer.scss, app/styles/colors.scss, app/styles/login.scss, app/styles/main.scss, app/styles/shared.scss, app/styles/styles.scss, app/styles/tagsinput.scss Verifying property wiredep.sass.src exists in config…OK Running "concurrent:server" […]

Grunt手表不工作

我尝试在node.js中通过grunt运行watch任务,但它不适用于我(这是我得到的): $ grunt watch warning: Maximum call stack size exceeded Use –force to continue. 这是Gruntfile.js中的监视任务的一部分: watch: { less: { files: 'src/less/*.less', tasks: ['clean', 'recess', 'copy'] }, js: { files: 'src/js/*.js', tasks: ['clean', 'jshint', 'concat', 'uglify', 'copy'] }, theme: { files: 'src/theme/**', tasks: ['clean', 'recess', 'copy'] }, images: { files: 'src/images/*', tasks: ['clean', 'recess', 'copy'] } […]

使用JSHint和Express.js /'delete'(保留字)

我正在使用Node.js的Express.js ontop来创buildRESTful API,并使用grunt来监视我的文件并自动将我的JavaScript删除。 每次使用删除function,它都会被JSHint标记: [L218:C9] Expected an identifier and instead saw 'delete' (a reserved word). app.delete('/api/users/:userid', function deleteUser(req, res, next) { 我明白'删除'是一个保留字,但它是由Express.jsselect的! 有没有更好的方式去linding我的Express.js应用程序? 任何方式来closures这个检查?

使用uglify将JavaScript打印到JavaScript

我在TS目录下有4个TypeScript文件。 我可以使用typescript typescript:base任务将它们全部编译成一个文件(main.js)和一个源映射(main.js.map)。 但是,在编译多个 TypeScript文件时,尝试uglify这些文件不起作用。 就好像sourceMapIn在sourceMapIn被多个文件创build的时候感到困惑。 你将如何编译一个带有多个文件的TypeScript项目到一个带有sourcemap的文件中(回到原来的ts文件) 这是咕噜声文件: module.exports = function (grunt) { grunt.initConfig({ uglify: { dist: { options: { sourceMap: '../js/main.min.map', sourceMapIn: 'main.js.map', sourceMapRoot: '../ts/' }, files: { '../js/main.min.js': ['main.js'] } } }, typescript: { base: { src: ['**/*.ts'], dest: '../js/main.js', options: { module: 'amd', sourcemap: true, declaration: false } } } }); grunt.loadNpmTasks('grunt-contrib-uglify'); […]

dynamic更新Gruntconfiguration字段

我在单独的目录中有几个项目,并希望以相同的方式构build它们。 我想从任务中定义项目名称(作为参数)。 Grunt任务将使用此项目path作为根path。 但我有几个子文件夹,不想手动更新,我只是想更新项目。 有这个机会吗? grunt.initConfig({ paths : { project : null, projectStylesheets : '<%= paths.project %>/stylesheets', // … } }); grunt.registerTask('server', function(project) { // -> project = 'some_name' var paths = grunt.config.get('paths'); paths.project = project; grunt.config.set('paths', paths); // -> { project: 'some_name', projectAssets: 'stylesheets' } }); 我想在他的configuration外使用JS函数,但不知道这是最好的做法。

Grunt:致命错误:观看EPERM

你可以在这里查看/克隆完整的代码: https : //github.com/mlewisTW/grunt-tests 我想看看 src目录(缩小,concat,less等),它把一切都放到build目录。 我也想看看生成目录,以便生活。 这是手表configuration代码片段: watch: { options: { livereload: false }, build: { files: ['<%= srcDir %>/**/*'], tasks: 'build' }, reload: { files: ['<%= buildDir %>/**/*'], options: { livereload: true } } }, 我在Windows 8上。我遇到了一个Fatal error: watch EPERM当我更改文件时Fatal error: watch EPERM ,并开始build任务的第一步(清理)。 我猜这与我试图删除一个观察目录的事实有关。 有什么方法可以在构build时closureslivereload watch任务,然后在完成时重新启动它? 有另外一个/更好的方法来做到这一点?

Grunt代码覆盖不起作用

我有下面这个运行mochatesting的grunt文件OK(运行grunt.js后我得到testing结果)现在我想添加一个代码,并使用https://github.com/taichi/grunt-istanbul模块。 但是当我运行grunt.js什么也没有发生,有什么想法? 我想要的只是之后,摩卡testing正在运行它将运行代码覆盖与一些报告 ? 任何新的代码覆盖将是伟大的 这是我的项目结构 myApp -server.js -app.js -test -test1.spec -test2.spec -test-reports -grunt.js -utils -file1.js -file2.js -controller -file1.js -file2.js 这是我尝试过的咕噜声中的代码 module.exports = function (grunt) { var path = require('path'); process.env.RESOURCE_PATH_PREFIX = "../"; var d = new Date(); var datestring = d.getDate() + "-" + (d.getMonth() + 1) + "-" + d.getFullYear() + " " […]

Yeoman Angular.js grunt serve-d应用从livereload.js有很长的延迟?snipver = 1

我遵循Yeoman的指导来设置一个Angular.js应用程序。 除了从“localhost”到“0.0.0.0”的主机名之外, 我没有任何改变 。 当我做了grunt serve ,没有错误。 最后,我确实看到了Allo,Allo的首页,但是只有在livereload.js?snipver = 1的延迟超过30秒之后,才能获得GET。 正如你所看到的,服务器不会输出任何exception的东西。 我的整个项目在github上 。 我希望能够重新加载,并发现了一些嫌疑犯: /node_modules/grunt-contrib-connect/node_modules/connect-livereload/index.js有以下两个包含livereload url的函数。 第一个链接到“ http://my.ip.addr.ess:9000 / livereload.js ”,它有一个“无法获得”。 function getSnippet() { /*jshint quotmark:false */ var snippet = [ "<!– livereload script –>", "<script type=\"text/javascript\">document.write('<script src=\"http://'", " + (location.host || 'localhost').split(':')[0]", " + ':" + port + "/livereload.js?snipver=1\" type=\"text/javascript\"><\\/ script>')", "</script>", "" ].join('\n'); […]

grunt.jsconfiguration中常见configuration选项的inheritance

人们如何处理Grunt中的多个项目的常见configuration选项。 这些项目将共享一些常见的configuration选项,例如min ,但也有每个项目的私人或自定义configuration设置,例如,三个项目中只有一个需要less或有不同的选项。 有没有办法在项目之间共享这种通用configuration,使用inheritance或导入现有文件,还是每个项目都必须定义所有设置? 我所指的项目将驻留在目录层次结构中 root module1 grunt.js module2 grunt.js module3 grunt.js 有什么方法可以在root级别提供常见的configuration设置吗?

无法在目录中运行程序“npm”

当我遍历到src/main/app/文件夹结构,我有package.JSON &gruntfile,我能够运行npm install和grunt命令。 但是当我试图运行mvn jetty:run和项目的根文件夹中的一个属性文件当POM文件存在时,它将引发错误,它不能运行npm install在文件夹结构src/main/app/ 。 这是确切的错误: [INFO] ———————————————————————— [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (n pminstall) on project my-abc-web: Command execution failed. Cannot run program "npm" (in directory "C:\Users\Achyut_J01\Documents\GitHub\infras\my-abc\my-abc-web\src\main\app"): CreatePro cess error=2, The system cannot find the file specified -> [Help 1] 这是一个Windows机器。