Tag: gruntjs

如何将对象传递给Mochatesting

我有一个自定义的节点服务器,并将其作为对象传递给一些testing。 这是我的Gruntfile: module.exports = function(grunt) { // Add the grunt-mocha-test tasks. grunt.loadTasks('node_modules/grunt-mocha-test/tasks'); grunt.initConfig({ // Configure a mochaTest task pkg: grunt.file.readJSON('package.json'), mochaTest: { test: { options: { reporter: 'spec', globals : 'MyServer' }, src: ['./server/test/custom/*.js'] } } }); 如何在我的testing中使用我在Gruntfile中创build的variables? 还有另一种方式来传递东西到我的testing?

如何启动与咕噜茉莉testing?

我想创build一个咕task任务,当代码改变时自动运行茉莉花testing。 对于AMD的支持,我安装了grunt-template-jasmine-requirejs 。 我将这些行添加到我的gruntfile中: connect: { test : { port : 8000 } }, jasmine: { jasmine_tests: { src: 'src/**/*.js', options: { specs: 'spec/*Spec.js', helpers: 'spec/*Helper.js', host: 'http://127.0.0.1:8000/', template: require('grunt-template-jasmine-requirejs'), templateOptions: { requireConfigFile: 'public/js/app/config/config.js' } } } }, 现在我尝试通过inputgrunt jasmine开始我的testing。 但我得到的是这样的: 运行“jasmine:jasmine_tests”(茉莉花)任务 通过PhantomJStesting茉莉花规格 警告:PhantomJS无法加载您的网页。 使用–force继续。 由于警告而中止。 那里有什么可能是错的? 我的目录结构: – website3 – .grunt + grunt-contrib-jasmine + […]

咕噜警告:任务“concat”未find

我正在尝试一个简单的Grunt示例,但是我遇到了grunt-contrib-concat的问题 。 这是我的Gruntfile.js: $ cat Gruntfile.js module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options: { separator: ';' }, dist: { src: ['src/**/*.js'], dest: 'dist/<%= pkg.name %>.js' } } }); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.registerTask('default', ['concat']); 和我的package.json: $ cat package.json { "name": "Linker", "version": "0.0.0", "description": "A test project that is meant to be a dependency", "repository": […]

如何在grunt.js绑定服务器和客户端?

我是意味着堆栈开发的新手。 我有一个项目,其中有必要添加一个用户界面,通过咕噜编译。 我的服务器从命令node server服务器开始,gruntfile编译我所有的客户端。 但我需要我的grunt启动服务器并编译所有视图。 我添加了grunt-express ,将它添加到任务中,但是当我发出grunt serve时,服务器端就没有了。 它留在港口3000。 如何在grunt编译上实现双方? Gruntfile.js "use strict"; var LIVERELOAD_PORT, lrSnippet, mountFolder; LIVERELOAD_PORT = 35728; lrSnippet = require("connect-livereload")({ port: LIVERELOAD_PORT }); mountFolder = function(connect, dir) { return connect["static"](require("path").resolve(dir)); }; module.exports = function(grunt) { var yeomanConfig; require("load-grunt-tasks")(grunt); require("time-grunt")(grunt); yeomanConfig = { app: "client", dist: "dist", docs: "documentation" }; try { yeomanConfig.app […]

从grunt-autoprefixer迁移到grunt-postcss

只要grunt-autoprefixer已被弃用,我想迁移到grunt-postcss 。 我在grunt世界(和依赖关系)是一个相当新的东西,我找不到我需要在文档中进行迁移的东西。 处理我需要三个步骤: 1-卸载grunt-autoprefixer 我想我必须先运行npm uninstall grunt-autoprefixer –save-dev 2-安装grunt-postcss 然后npm install grunt-postcss –save-dev 但不知道如果我要做一个npm install grunt-postcss pixrem autoprefixer-core cssnano 3-更新configuration 然后我应该修改Gruntfile.js 。 所以其实我有这个部分: autoprefixer: { options: { browsers: ['last 1 version'] }, dist: { files: [{ expand: true, cwd: '.tmp/styles/', src: '{,*/}*.css', dest: '.tmp/styles/' }] } }, 我的问题: 你可以确认卸载/安装部分? 如何迁移configuration?

Yeoman应用程序部署到Heroku的问题

我一直在尝试将我的AngularFullstack(节点)应用程序部署到Heroku。 我在terminal中创build了应用程序: yo angular-fullstack 。 每当我尝试部署到Heroku,当我去我的部署应用程序时,我得到以下内容: 应用程序错误 应用程序发生错误,您的页面无法送达。 请稍后重试。 如果您是应用程序所有者,请查看日志以获取详细信息。 日志是: 2015-07-24T06:57:35.184227+00:00 heroku[web.1]: State changed from up to starting 2015-07-24T06:57:38.772056+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2015-07-24T06:57:39.757747+00:00 app[web.1]: Error waiting for process to terminate: No child processes 2015-07-24T06:57:40.645233+00:00 heroku[web.1]: Process exited with status 22 2015-07-24T06:57:49.314501+00:00 heroku[web.1]: Starting process with command `npm start` 2015-07-24T06:57:51.176323+00:00 app[web.1]: Detected […]

警告:找不到任务“browserfy”

我想使用browserfy将es6文件转换为es5。 但每次执行监视任务时,都会出现以下错误: 警告:找不到任务“browserfy”。 使用–force继续。 我使用下面的gruntfile(简化)自动化任务: grunt.initConfig({ browserfy: { dist: { options: { transform: [ ["babelify", { loose: "all" }] ] }, files: { "dist/module.js": ["lib/main.js"] } } }, watch: { lib_test: { files: '<%= jshint.lib_test.src %>', tasks: ['jshint:lib_test', 'browserfy'/*, 'qunit'*/] } }}); grunt.loadNpmTasks("grunt-browserify"); grunt.loadNpmTasks('grunt-contrib-watch'); 我也使用了这个命令 npm安装grunt-browserify –save-dev

Grunt SASS contrib不会在目标目录中生成css文件

我是SASS的新手,我想用grunt-contrib-sass在本地编译Prestashop模板的.scss文件。 它configuration如下: sass: { dist: { options: { compass: true }, files: [{ expand: true, cwd: '_theme/themes/swat-theme/sass', src: ['*.scss'], dest: '../css', ext: '.css' }] } }, 当我在命令行上运行grunt sass时,它会显示: 完成,没有错误 然而,当我检查目标目录时,不会创build新的.css文件(在运行grunt sass之前,我也试图删除一些文件)。 我该如何解决这个问题?

我在哪里注册我的JS,以便它被添加grunt?

我用了一个yeoman生成器(html5网站)。 我有一个现有的项目,我想翻译成咕噜/鲍尔工作stream程。 我有一个.js文件,做我想要的,从旧的项目。 将其复制到新的基于bower / grunt的项目的开发文件夹中不会导致它被连接到最终的单个mainsite.js。 所以我检查了gruntfile.js并在这里添加它: concat : { options: { banner: '<%= banner %>', stripBanners: false }, main : { src : [ 'bower_components/jquery/dist/jquery.js', 'bower_components/jQueryui/ui/jquery-ui.js', 'bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.js ', 'bower_components/RWD-FitText.js/jquery.fittext.js', 'bower_components/BrowserDetection.js/BrowserDetection.js', 'bower_components/respond/dest/respond.src.js', 'main-2k15-dribble/JavaScript/Main.js', 'main-2k15-dribble/JavaScript/mainsite.js', this added—> 'main-2k15-dribble/JavaScript/jribble.js' ], dest : 'main-2k15-dribble-pub/js/mainsite.js' } }, 我特别想知道我需要做些什么来将我现有的JavaScript添加到由grunt和bowerpipe理的项目中? 一般来说,我从来没有见过明确的描述什么文件夹是什么意思,以及工作stream程添加到脚手架的项目。 但我觉得必须有一些维基或什么教这个! 我不相信开发者会通过线索和错误发现

Grunt构build打破了我编译的JavaScript

我有一个从一开始就不是我的项目,整个部署是不完整的。 我有惊吓忽略覆盖指定在这里 ,现在我发现,当他生成vendor.js与所有的依赖关系,它根本无法工作。 浏览器打印: Uncaught TypeError: Cannot read property 'Item' of undefined(anonymous function) @ vendor.js:14(anonymous function) @ vendor.js:14 vendor.js:4 Uncaught Error: [$injector:nomod] Module 'gettext' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.2.14/$injector/nomod?p0=gettext(anonymous function) @ […]