gruntjs

Generating source maps from browserify using grunt

时光怂恿深爱的人放手 提交于 2019-12-03 04:36:31
I have followed the instructions here: https://www.npmjs.org/package/grunt-browserify , to try and set up source maps for browserify on grunt. The options for browserify in my gruntfile are : browserify: { options: { bundleOptions : { debug: true } }, dist: { files: { "public/client.bundle.js": ["bundle.js"] } } } The generation of bundle.js happens without any issues, however the source map generation does not happen. Is there anything wrong with my grunt-browserify options. Thanks for looking. use browserifyOptions instead of bundleOptions browserify: { options: { browserifyOptions: { debug:

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

穿精又带淫゛_ 提交于 2019-12-03 04:30:33
问题 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? 回答1: Where do those variables get derived from? Starting broadly, read the

How grunt watch files in sub folders?

家住魔仙堡 提交于 2019-12-03 04:27:19
问题 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? 回答1: Per the official documentation on file globbing, to watch for changes for files of a certain file type in

Centralise node_modules in project with subproject

三世轮回 提交于 2019-12-03 04:25:13
问题 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,

Exporting a class with ES6 (Babel)

五迷三道 提交于 2019-12-03 04:23:16
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(grunt) { "use strict"; grunt.loadNpmTasks('grunt-babel'); grunt.loadNpmTasks('grunt-browserify'); grunt

Big JS app testing - avoiding multiple karma.conf.js files

雨燕双飞 提交于 2019-12-03 04:22:59
I use karma + jasmine + phantom for my headless Javascript tests. The problem I have is that I have a really big app consisting of a lot of JS modules which I want to test. So I need custom mocks for each case and custom includes for each case. karma.conf.js allows me only to have files array which consist of patterns for all the files to include which is GREAT if my app would be small and not a big app with ton of files and modules. My solution for now - create multiple karma.conf.js files for each test case. But this really sucks as having so lot of config files is a big bloat and if I would

Does Meteor need either Gulp or Grunt?

送分小仙女□ 提交于 2019-12-03 04:20:41
问题 So I've been reading about Gulp and Grunt, and how they can minify code, compress files, combine files into one, livereload etc. However, Meteor does all that already, with Isobuild. The reason I'm asking is someone suggested using Gulp with Meteor, and I don't see a need for it. What are some possible reasons why I should run Gulp alongside Meteor? Or it is simply redundant? If it is not redundant, what features does Gulp has that is not in Isobuild? And will the Meteor team plan to

Angular resource testing: $httpBackend.flush() cause Unexpected request

瘦欲@ 提交于 2019-12-03 04:18:20
I want to test angularjs resource. 'use strict'; /** * AddressService provides functionality to use address resource in easy way. * * This is an example usage of method: * * `get`: * var a = AddressService.get({id: '1'}, function (data) { // Work here with your resource } ); * */ App.factory('AddressService', function ($resource, $rootScope) { var url = [ $rootScope.GLOBALS.API_PATH, $rootScope.GLOBALS.API_VERSION, 'models/address/:id' ].join('/'), actions = { 'get': { method: 'GET', params: {id: '@id'} } }; return $resource(url, {}, actions); }); I created the test: 'use strict'; var

What is workflow in Yeoman to work with Sass files?

℡╲_俬逩灬. 提交于 2019-12-03 04:12:09
问题 I try to use yeoman but I don't know how to use my own sass files with it. With grunt server Sass files are watched and compiled into .tmp/styles/ But there is no reference to the compiled stylesheet, except <link rel="stylesheet" href="styles/main.css"> So, what is the recommended way to use the compiled sass files in index.html during development? E.g. grunt server , if I change my style app/styles/my.sass into .tmp/styles/my.css , this is overwritten and it is outside the server (localhost

Grunt task output then calling grunt-notify

匆匆过客 提交于 2019-12-03 03:51:44
Grunt notify: https://github.com/dylang/grunt-notify is great. However, it seems a bit limited. As far as I can tell all my messages need to be pre-generated. So the first question is how can I generate notifications? Next, It seems that grunt notify triggers based on error or success of some task. I guess based on std in/out/err? The problem where this breaks down is if some task doesn't use these. grunt compass doesn't use stderr if there are compile errors. So how can I run grunt notify when it has an error? This then leads to the next question. How can I grab the console output or stderr