草庐IT

grunt-express

全部标签

javascript - 运行跨多个 grunt.js 文件配置的任务

我有一个包含多个未发布模块的Node应用程序。我的应用程序的package.json包含一些git依赖项:"module-a":"git+ssh://git@github.com:me/module-a.git","module-b":"git+ssh://git@github.com:me/module-b.git"并且每个都有自己的grunt配置。例如在node_modules/module-a/grunt.js中:module.exports=function(grunt){grunt.initConfig({lint:{files:['server/**/*.js','test

javascript - Grunt 构建导致 Angular 应用程序在 dist 上崩溃

我正在使用Grunt并执行命令“gruntbuild”来创建一个包含AngularJS应用程序的分发文件夹。作为独立应用,我的应用运行良好。一旦我为该应用程序创建了一个分发版,该应用程序就开始很快崩溃。我在F12工具控制台中看到的是:达到10次$digest()迭代。中止!我怀疑我的.tmp目录中有一个名为vendor.js的文件,并且由于Controller依赖注入(inject)变量将注入(inject)的Controller参数(如“$scope”转换为“a”)而无法正确缩小、丑化和/或连接此文件例如,即使我使用的是ngAnnotate。看到我正在使用UglifyJs并在Ugli

javascript - Grunt bower_concat 不添加 css

我尝试使用bower_concathttps://github.com/sapegin/grunt-bower-concat从我的bower_components编译我所有的css.js编译得很好,但css永远不会被创建。这是我的这一部分的grunt文件代码:bower_concat:{all:{dest:'/lib/_bower.js',cssDest:'/lib/_bower.css',dependencies:{//'angular':''},exclude:['jquery'],bowerOptions:{relative:false},includeDev:true}},它从

javascript - 使用 Grunt (Yeoman) 的多个构建文件夹(多个客户端、多任务、多个目标)

我现在正在构建一个项目,它将是一个web应用程序(可在浏览器上运行)和一个Phonegap应用程序(iOS和Android)。尽管从理论上讲,我的项目可以使用与我的Yeoman相同的dist文件夹。生成,Grunt通过运行gruntbuild任务build生产就绪代码。我想运行类似gruntbuild_web、gruntbuild_ios和gruntbuild_android的程序,分别为每个平台构建生产代码。或者gruntbuild:web、gruntbuild:ios、gruntbuild:android。这样,我就可以自定义一些加载的脚本、图像等,每个脚本、图像等都有自己的构建指

javascript - 如何有条件地编译(使用 Grunt)仅使用模板包含更改的 Jade 文件

使用grunt-contrib-watch推荐的只编译更改文件的版本在这里:https://github.com/gruntjs/grunt-contrib-watch#compiling-files-as-neededvarchangedFiles=Object.create(null);varonChange=grunt.util._.debounce(function(){grunt.config('jshint.all.src',Object.keys(changedFiles));changedFiles=Object.create(null);},200);grunt.ev

javascript - 将 Grunt 集成到 Spring/Gradle 构建中的正确方法是什么?

我有一个使用Gradle构建的SpringBoot项目。我所有的前端代码都在src/main/resources/static下。这还包括我的bower_components、node_modules(用于Grunt任务)等。现在,我的主要Gradle构建脚本执行Grunt构建,它连接/缩小了我所有的JavaScript,它们位于src/main/resources/static/dist下。然后,当processResources在Gradle中执行时,整个src/main/resources/static/dist被复制到构建目录。这对我来说似乎不正确——唯一应该在构建目录中结束的

javascript - 如何正确设置 Node、Express 和 Angular2

我正在尝试使用Node、Express、Angular2(数据库、MongoDB或SQL)设置工作区但我不确定如何正确设置组合。目前我的文件结构是这样的,打算把front-end放在public文件夹下。──package.json├──public├──routes│  └──test.js├──server.js└──views到目前为止,我的server.js看起来像这样varexpress=require('express');varmysql=require('mysql');varcookieParser=require('cookie-parser');varbodyPa

javascript - Grunt 代码覆盖不起作用

我有以下运行mocha测试的grunt文件(我在运行grunt.js后得到测试结果)现在我想添加代码并使用https://github.com/taichi/grunt-istanbul模块。但是当我运行grunt.js时没有任何反应,知道吗?我想要的只是在mocha测试运行之后它会运行代码覆盖率和一些报告?任何新的代码覆盖率都会很好这是我的项目结构myApp-server.js-app.js-test-test1.spec-test2.spec-test-reports-grunt.js-utils-file1.js-file2.js-controller-file1.js-file

javascript - 无法访问 Express/NodeJS 中的 req.session 变量

我见过这个问题的许多变体,但似乎没有一个能解决我的问题。我正在尝试使用Express设置一个Node.js服务器。这是我的服务器配置:varexpress=require('express'),RedisStore=require('connect-redis')(express);varapp=express();app.use(express.urlencoded());app.use(express.json());app.use(express.cookieParser());app.use(express.session({store:newRedisStore(),secr

javascript - Node.js & Express.js 字体区分

我在Node.js和Express.js上随意开发了示例。在启动下面显示的每个的example.js之后,我遇到了它们之间的字体差异。即使我知道Express是Node的框架,但我找不到任何地方为什么排版会发生变化。Node.js:consthttp=require('http');consthostname='127.0.0.1';constport=3000;constserver=http.createServer((req,res)=>{res.statusCode=200;res.setHeader('Content-Type','text/plain');res.end('