Tag: gruntjs

在同一端口上运行Angular Web App和NodeJS服务器?

我使用Yeoman来build立一个基本的angularjs web应用程序,我使用Grunt来构build和运行,并且我已经制作了一个基本的nodejs服务器,并带有一些angular度应用程序用来获取数据的端点。 然而,我想在同一个端口上运行angular度应用程序和节点服务器,有没有办法从我的节点服务器angular度应用程序服务,而不使用grunt serve或grunt serve:dist ? 在从节点服务器提供服务之前,我仍然能够缩小我的angular度应用程序吗? 澄清:例如,如果我去http://localhost/它应该服务angular应用程序,但是,如果我去http://localhost/api/xyz它应该服务的节点端点。

Grunt – 同时执行和观看应用程序

我正在开发一个简单的节点应用程序,我碰到了这个叫做grunt-cli的工具。 在介绍到咕噜之后,我打算把它和我的应用程序一起使用。 Gruntfile.js module.exports = function(grunt){ grunt.initConfig({ execute: { target:{ src: ['app.js'] } }, watch: { scrpits: { files: ['app.js'], tasks: ['execute'], options: { spawn: false } } } }); grunt.loadNpmTasks('grunt-execute'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['execute', 'watch']); }; 的package.json { "name": "exampleapp", "version": "1.0.0", "description": "", "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && […]

Node.js服务器文件console.log()在使用Grunt启动服务器时不显示

我正在使用grunt命令启动我的节点应用程序。 我的Gruntfile.js是: module.exports = function(grunt) { grunt.initConfig({ nodemon: { dev: { script: 'server.js' } }, watch: { css: { files: ['src/css/*.scss'], tasks: ['sass:dev'] }, js: { files: ['src/js/*.js'], tasks: ['uglify:dev'] } }, concurrent: { options: { logConcurrentOutput: true }, tasks: ['nodemon','watch'] } }); grunt.loadNpmTasks('grunt-nodemon'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-concurrent'); grunt.registerTask('default',['concurrent']); }; 当我运行应用程序打字grunt我得到以下输出: C:\Projects\SocialMeal>grunt Running "concurrent:tasks" (concurrent) task Running […]

如何同步(编程)运行Grunt任务?

我想要一个在一个循环中同时运行子任务的任务,当一个子任务改变一个标志的值时,这样的循环就会被中断。 这是我正在尝试做的一个示例: grunt.registerTask('complexTask', 'Run sub-tasks synchronously.', function () { var value; do { // 'changeValueTask' task sets 'importantValue' grunt.task.run(['preTask', 'changeValueTask', 'postTask']); value = grunt.config('importantValue'); } while (!value); // … end task }); 我想从中得到什么是 确保每一组任务 ( ['preTask', 'changeValueTask', 'postTask'] )按顺序运行(依次) 并打破循环的最佳方式 有没有可能实现这个? 注意:在一些研究之后,我能find的最接近的东西是Grunt允许定义如果task A没有完成,给定的task B就会失败(用grunt.task.requires : grunt.task.requires('A') )。

麻烦运行使用grunt静态服务器的Qunittesting

通过networking浏览器运行testing工作正常,但使用grunt给我错误。 我很难理解我在这里做错了什么。 grunt tests失败 $ grunt tests Running "jsonlint:sample" (jsonlint) task >> 4 files lint free. Running "jshint:all" (jshint) task >> 4 files lint free. Running "connect:server" (connect) task Started connect web server on http://localhost:5000 Running "qunit:all" (qunit) task Testing http://localhost:5000/tests/tests.html F >> Settings.json tests – Fetching settings file >> Message: InvalidStateError: DOM Exception 11: […]

Grunt grunt-postcss Autoprefixer不能正常工作

我已经跳进了一个非盈利的开源项目,并且想要帮助一下,但是我不熟悉Grunt。 我做了一些研究,不知道为什么configuration不起作用。 这是我正在尝试使用的插件。 它允许应用几个后处理器,但我现在只需要Autoprefixer: https : //github.com/nDmitry/grunt-postcss configuration: Gruntfile.js http://pastebin.com/4Ud0sa1W grunt/concurrent.js http://pastebin.com/Satr1wSK grunt/sass.js http://pastebin.com/rc6evWas grunt/watch.js http://pastebin.com/eGBpFSLs 任务得到执行没有问题: laptop:website lextoc$ grunt sass:postcss Running "sass:postcss" (sass) task Done. 但是,CSS文件没有得到所需的供应商前缀,我使用display: flex来检查它是否工作。 原来的项目(我分叉它)可以在这里find: https : //github.com/faforever/website

如何在我的angular度js应用程序中正确设置checklist-model指令?

我是一个noob与node.js /咕噜世界,所以我很抱歉,如果这个问题是非常愚蠢的… … – 我有一个与yeoman / grunt一起工作的angular.js项目,现在我想要做的就是包含一个指令,特别是这个指令, 但我不知道如何安装它! 我有: 在我的命令提示符下使用命令npm install checklist-model 链接index.html文件内的脚本 <script src='node_modules/checklist-model/checklist-model.js'></script> – 并在我的应用程序中添加依赖项 var app = angular.module('generaPreventivoApp', [ 'ngAnimate', 'ngCookies', 'ngResource', 'ngRoute', 'ngSanitize', 'checklist-model' ]); 控制台给我以下错误: Error: [$injector:modulerr] Failed to instantiate module app due to: [$injector:modulerr] Failed to instantiate module checklist-model due to: [$injector:nomod] Module 'checklist-model' is not available 我怎样才能正确设置?

了解gruntjs registerTask冒号

我目前正在尝试学习开发和生产版本的gruntjs。 我想分配一个全局configurationvariables来确定的东西。 我有一个简单的initConfig : grunt.initConfig({ foo: { bar: {GLOBAL: true}, baz: {GLOBAL: false} } }); grunt.registerTask('one', ['foo:bar']); grunt.registerTask('two', ['foo:baz']); 我的问题是: 我的任务中究竟冒着什么结肠? ( foo:bar or foo:baz ) 冒号和简单点之间有什么区别? 我的目标是将全局variables设置为true或false以便进一步处理: grunt.initConfig({ foo: { bar: {GLOBAL: true}, baz: {GLOBAL: false} }, awesomestuff: { smth: GLOBAL ? 'yes' : 'no', another: !Global ? 'DoDebug' : 'MakeRelease' } }); grunt.registerTask('one', […]

通过grunt传递node.js选项

当我在命令行上开始咕噜时,如何将一个parameter passing给节点进程? 具体来说,我想将选项–expose-gc传递给运行grunt的节点。 我运行的命令是: grunt mocha:mytests 我想实现,我的摩卡testing暴露垃圾收集界面。 如果有任何帮助:grunt文件部分如下所示: myTest: { src: [ 'mocha.hooks/*.spec.js', 'build/ch.actifsource.*/**/test/*.spec.js', 'mocha.hooks/*.spec.server.js', 'build/ch.actifsource.*/**/test/*.spec.server.js' ], options: { timeout: 500, logErrors: true }, ignore: [ './src/**/RegisterResourceTypes.js' ] }

Angularjs无法find模块后与requirejs优化器optmize

我有这个回购在这个提交angularseed:a9ad4568bd8534b888ae5cb3bf1a7f92f66d633d(只是学习工具和库)。 也许有人可以帮助我。 当我尝试使用requirejs优化我的代码时出现问题。 我使用grunt-contrib-requirejs。 要查看问题,您必须克隆回购。 Nodejs是强制性的。 https://github.com/neonds/angularseed.git cd angularseed npm run configure //to download deps npm run dev //then open http://localhost:9000 npm run prod 当我运行prod脚本时,似乎ngRouter没有正确加载和。 有人可以帮我find问题吗? 错误login控制台 Gruntfile: module.exports = function(grunt) { 'use strict'; grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), project: { src: 'src', vendor: 'bower_components', build: 'build', dist: 'dist', }, […]