gruntjs

Exporting a class with ES6 (Babel)

那年仲夏 提交于 2019-12-03 14:37:21
问题 I'm writing some frontend code with ECMAScript 6 (transpiled with BabelJS, and then browserified with Browserify) so that I can have a class in one file, export it and import it in another file. The way I'm doing this is: export class Game { constructor(settings) { ... } } And then on the file that imports the class I do: import {Game} from "../../lib/pentagine_browserified.js"; var myGame = new Game(settings); I then compile it with grunt , this is my Gruntfile : module.exports = function

usemin revved filenames and requirejs dependencies

喜欢而已 提交于 2019-12-03 14:36:31
I'm running into the following problem with requirejs and usemin: I want to setup a multipage application, where I dynamically load modules that only contain page specific functionality (e.g. about -> about.js, home -> home.js). I could go ahead and pack everything in a single file, but that just leads to a bigger file size and overhead on functionality that isn't necessary on each site! (e.g. why would I need to load a carousel plugin on a page that doesn't have a carousel!) I checked out the example https://github.com/requirejs/example-multipage-shim That is in fact a great way to deal with

Webstorm does not recoginize Grunt

杀马特。学长 韩版系。学妹 提交于 2019-12-03 14:21:30
So I have messed up with removing and installing node and npm to install packages without sudo and now I can't use Grunt panel in Webstorm The message is: grunt --no-color --gruntfile /Users/max/repos/cb/Gruntfile.js --tasks /Applications/WebStorm.app/plugins/JavaScriptLanguage/grunt_js/tasks _intellij_grunt_tasks_fetcher Cannot run program "grunt" (in directory "/Users/max/repos/cb"): error=2, No such file or directory Looks like the grunt command isn't in your system path. In order to view/run tasks, you need to install Grunt's command line interface globally: npm install -g grunt-cli For

how to install underscore.js in my angular application?

左心房为你撑大大i 提交于 2019-12-03 13:56:50
I used yo-angular to generate my angularjs template with bootstrap/grunt/bower. I also want to use underscore in the app: npm install underscore --save-dev In the MainCtrl I am calling underscore.js just to see whether it works: angular.module('yomanApp') .controller('MainCtrl', function ($scope) { $scope.awesomeThings = [ 'HTML5 Boilerplate', 'AngularJS', 'AngularJS' ]; _.each([1,2,3],console.log); }); When I run the application with Chrome I get this errmsg in the console: ReferenceError: _ is not defined at new <anonymous> (http://localhost:9000/scripts/controllers/main.js:18:5) at invoke

Grunt module to inject HTML templates

醉酒当歌 提交于 2019-12-03 13:49:27
Recently started using Grunt as a build tool for a web app I'm hobbyist developing. I have a series of HTML files (to be used as templates), in a single folder, that I'd like injected at a particular point in the main HTML file. Ideally, I could also wrap each file in a tag, but having to manually include this in the template files themselves is acceptable. Is there an existing Grunt module to perform this? EDIT: I may have worded my problem poorly before. Essentially, I have a single HTML file where the app will run (Single page app, business simulation game). In a separate folder, I have a

How do I tell Grunt to NOT minify or concatenate js files in a build task?

只谈情不闲聊 提交于 2019-12-03 13:04:12
I've just scaffolded an Angular app using Yeoman. I've noticed that the build task does several things by default, including minifying and concatenating js files. I'd like to have a simpler build task that didn't do any minifying or concatenation, and, instead, only did the following two things: compile my .scss into .css copy a working app into my distribution directory Can anyone help me write a grunt task that will do (only) these two things? Many thanks. Ok, I've edited the default grunt file so that it does what I want. My solution involved writing tasks called copy:devDist and compass

error when starting the server with grunt or node server

空扰寡人 提交于 2019-12-03 12:53:01
问题 I am trying to use the mean stack as described here : http://mean.io/ after install, when making "grunt", there is an error : debugger listening on port 5858 4 Jan 01:47:40 - [nodemon] reading ignore list Express app started on port 3000 events.js:72 throw er; // Unhandled 'error' event ^ Error: failed to connect to [localhost:27017] at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74) at EventEmitter.emit (events.js:106:17) at null.

React and Grunt - Envify NODE_ENV='production' and UglifyJS

孤人 提交于 2019-12-03 12:51:06
I am using Grunt to build a React project and I want to have 'dev' and 'prod' flavours. As react docs says: To use React in production mode, set the environment variable NODE_ENV to production. A minifier that performs dead-code elimination such as UglifyJS is recommended to completely remove the extra code present in development mode. I am very new using grunt, browserify and stuff but let's see. First problem I have is with envify, I use it as a transform: browserify: { options: { transform: ['reactify'], extensions: ['.jsx'] }, dev:{ options: { watch: true //Uses watchify (faster) }, src: [

How to get grunt.js to start an express app for testing

放肆的年华 提交于 2019-12-03 12:50:01
My current situation is that I use grunt to make a production version of my express app (minimize and merge all the js/css, copy all the files in place) and then I have to run a script which sets an environment variables (my app only serves the test harness when running in TEST mode), creates an empty Mongo test database and then calls npm start on the application directory, and then I manually have to run the tests from either Chrome or Phantom, what I want to do is have grunt set the environment variable and run the server, run the tests, and then stop the server (in the future if all is

NPM doesn't install module dependencies when deploying a Grunt app to heroku

萝らか妹 提交于 2019-12-03 12:46:58
I'v made a static single page site using grunt. I'm now trying to deploy it to heroku using the heroku-buildpack-nodejs-grunt for node grunt. Below is a pic of my root directory: Here's my Gruntfile package.json : Procfile : web: node index.html When I run $ git push heroku master it gets to the Gruntfile and fails: -----> Found Gruntfile, running grunt heroku:production task >> Local Npm module "grunt-contrib-uglify" not found. Is it installed? The above errors proceed to list all local NPM modules as not found. If I list all loadNpmTasks instead of using "load-grunt-tasks", I get the exact