gruntjs

Grunt livereload with node.js application

我与影子孤独终老i 提交于 2019-12-02 18:22:51
I have written an application in Node.js (with Express & socket.io) and I would like to use Grunt to compile my client-side stuff with livereload while developing and being connected to Node.js application. How can I do this? (Preferably without running Node.js app in another port and client in another port, because of pathing and cross-domain issues) I installed also Yeoman and it's using out of the box grunt-contrib-livereload package, but from what I understood it's using Node.js Connect server for serving client-side files, thus being separated from my Node.js application.. Example from

How can I automate both E2E and unit tests with Yeoman & AngularJS?

风格不统一 提交于 2019-12-02 17:57:33
I'm using Yeoman and generator-angular to manage AngularJS apps, but I'm having trouble with automated testing. Running grunt test will run unit tests once. I can get E2E tests to run after unit tests by altering the karma config block in Gruntfile.js , adding e2e: karma: { //... e2e: { configFile: 'karma-e2e.conf.js', singleRun: true } }, Great: now when I type grunt test all tests are run. But they're only run one time, and there's a big overhead (starting compass, running the server, launching the Chrome processes, etc.). Instead, the server and Chrome processes should remain running and,

What's the difference between concat and uglify and minify?

二次信任 提交于 2019-12-02 17:50:52
What's the difference between concat, uglify, and minify tasks in grunt? I set up an uglify task for all of my site's javascript tasks, and it seemed to both minify and concatenate them. Grunt's site has a great description for how to configure each task, but it doesn't seem to explain what each task actually does. diclophis Concatenation is just appending all of the static files into one large file . Minification is just removing unnecesary whitespace and redundant / optional tokens like curlys and semicolons, and can be reversed by using a linter. Uglification is the act of transforming the

How grunt watch files in sub folders?

自古美人都是妖i 提交于 2019-12-02 17:50:12
My codes folders and files like this, you never know how many sub folders in it: js/sub1/a.js js/sub2/b.js js/sub3/sub31/c.js js/sub4/sub41/sub411/d.js Here is part of the Gruntfile.js: grunt.initConfig({ watch: { src: { files: ['js/*.js'], tasks: [] } } }); Grunt can't watch the changes of my all JavaScript files by using 'js/*.js' . So how to write the correct file path expression? ashox Per the official documentation on file globbing , to watch for changes for files of a certain file type in the directory path and its subdirectories, you'll want: files: ['js/**/*.js'] 来源: https:/

Centralise node_modules in project with subproject

泄露秘密 提交于 2019-12-02 17:38:56
is it possible to configure grunt in a way that you have the required modules on a central point? I have following project structure -Project -- subproject -- subproject -- subproject I build the project via grunt with all subprojects, and I can build each subproject for itself too. Currently I have a Gruntfile.js, package.json & folder node_modules (~50mb) with all required modules in each subproject and on the root level. So is it possible to have the node_modules folder only on one level, for e.g. on the root level and the subprojects refer to the node_modules on root level? -Project -

Is it possible to compile grunt project from maven?

点点圈 提交于 2019-12-02 17:16:07
I'm trying to execute grunt tasks from within maven without needing to install Node.js or anything. This is because I wan't my artifact to be packaged by Jenkins and I can't install Node.js on that machine. I know that it's easy with npm and a few commands to get it working, but I also think that it should be easy to integrate with maven, the problem is that I don't know where to start since I'm new to npm. Yes, using the frontend-maven-plugin , you can compile Grunt projects via Maven (found via the NodeJS mailing list ). As the documentation points out, the plugin has the following features:

Grunt compiling Jade files

拥有回忆 提交于 2019-12-02 17:12:23
I'm trying to configure my Gruntfile to compile all of my Jade files to individual HTML files. For example, if I have the following source folder: source └── templates ├── first.jade ├── second.jade └── third.jade Then I would expect grunt jade to output: build └── templates ├── first.html ├── second.html └── third.html Here's my Gruntfile using grunt-contrib-jade : module.exports = function(grunt) { grunt.initConfig({ jade: { compile: { options: { client: false, pretty: true }, files: [ { src: "*.jade", dest: "build/templates/", ext: "html", cwd: "source/templates/" } ] } }, }); grunt

npm peerDependency issue with grunt and flatiron peer

别来无恙 提交于 2019-12-02 17:07:51
While posting this question I figured out the answer, but I'll post both here in case it helps someone else, and perhaps someone can help with the why of what happened. When I run: sudo npm install -g grunt the last part of it says: /usr/bin/grunt -> /usr/lib/node_modules/grunt/bin/grunt npm ERR! peerinvalid The package flatiron does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer flatiron-cli-config@0.1.3 wants flatiron@~0.1.9 npm ERR! peerinvalid Peer flatiron-cli-users@0.1.1 wants flatiron@~0.1.9 npm ERR! System Linux 3.5.0-23-generic npm ERR! command

<%= yeoman.app %> and <%=yeoman.dist %> variables for a gruntfile

牧云@^-^@ 提交于 2019-12-02 16:59:07
I often see in some example gruntfiles the use of <%= yeoman.app %> and <%= yeoman.dist %> environment variables. I haven't used this myself but where do those variables get derived from? Also, is it possible to override those variables? Does one need to have yeoman in order to use those particular environment variables? I've read through the documentation and the FAQ . Are there resources that discusses this more? Where do those variables get derived from? Starting broadly, read the Gruntfile example as it starts to address the <%= variable %> syntax. If you are new to Grunt, bookmark that

Grunt dependencies conflicts in Bootstrap

喜你入骨 提交于 2019-12-02 16:57:43
I've downloaded Bootstrap source files from the official website and I'm getting dependency conflicts when installing the project using node's npm . I have grunt 0.4.3 installed on my machine but some bootstrap dependencies require 0.4.0 and some 0.4.1 . The npm install -g grunt-cli command executed without any problems. Here's the log that I'm getting after executing npm install command: npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer grunt-banner@0.2.1 wants grunt@~0.4.1 npm ERR! peerinvalid Peer grunt-contrib