FAQ Database Discussion Community


Add locale moment to an AngularJS app

angularjs,gruntjs,momentjs
I'm trying to configure the locale language for an AngularJS app based on Yeoman. When I serve the dist package after building my app (grunt build), the script reference dissapears. Here's a list of my dependencies on the index.html file. <!-- build:js(.) scripts/vendor.js --> <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> <script...

Error using Grunt watch and SASS

node.js,sass,gruntjs
I am trying to use grunt watch t with SASS on Windows, but everytime I get an error Waiting... OK >> File "scss\main.scss" changed. Running "sass:dist" (sass) task Error: Error generating source map: couldn't determine public URL for the source stylesheet. No filename is available so there's nothing for the...

message: 'Unexpected token: punc (.)', while using uglify in grunt

javascript,css,gruntjs,grunt-contrib-uglify
Goal My goal is to concatenate all my css,js files and minify all of them. I can minify my concat.js, but I'm struggling trying to minify my concat.css. Gruntfile.js module.exports = function(grunt) { "use strict"; grunt.initConfig({ concat: { js: { src: [ 'js/bootstrap.min.js', 'js/jquery-1.10.2.min.js', 'js/jquery.easypiechart.min.js', 'js/jquery.isotope.min.js', 'js/jquery.magnific-popup.min.js', 'js/waypoints.min.js', 'js/respond.min.js', 'js/jquery.vegas.min.js',...

Why are my SVG icons clipped when using grunt svg sprite?

html,css,svg,gruntjs
I am using grunt-svg-sprite module (https://www.npmjs.com/package/grunt-svg-sprite) to create a sprite with the view mode and symbol mode as shown below: svg_sprite: { svg_icons: { expand: true, cwd: 'src/app/assets/artwork/svgs', src: ['**/*.svg'], dest: 'src/app/assets/artwork', options: { shape: { spacing: { // Spacing related options padding: 1, // Padding around all shapes box:...

How can I minify my index.php using grunt?

php,html,optimization,gruntjs,minify
I want to achieve this using grunt Goal My main goal is to minify my index.php before placing them on my production server. It's simple if I have 1 single index.html, but I don't. Instead I have an index.php full with other .php files. Each <?php ?> section is...

Compiling SASS files using Grunt creates an unnecessary folder

javascript,css,sass,gruntjs
So I have been trying to create my first compiled css files using grunt and sass, and i am having a problem that I cant figure it out. Every time that I run the sass task, an unnecessary "sass" folder is created inside of my css folder: This is how...

Grunt-contrib-copy: variables within the rename function

javascript,gruntjs,grunt-contrib-copy
I have the following copy task in a gruntfile.js copy: { css: { expand: true, cwd: 'min/css', src: 'theme_<%= props.majorversion %>.<%= props.minorversion %>.min.css', dest: 'dest/dir/', rename: function(dest, src) { return dest + src.replace('_<%= props.majorversion %>.<%= props.minorversion %>',''); } } } Currently, the file is copied successfully but once copied, I'd...

Why doesn't postinstall run everytime?

jenkins,gruntjs,npm
I have a package.json file that has the following JSON at the bottom. "scripts": { "postinstall": [ "./node_modules/bower/bin/bower install && ./node_modules/protractor/bin/webdriver-manager update" ] } My reason for having this is so bower dependencies and my protractor tests will run after an "npm install". However, it seems that "postinstall" doesn't always...

Grunt start Node Server and then open browser

javascript,node.js,gruntjs,connect
I have grunt task that starts the server: module.exports = function(grunt){ grunt.registerMultiTask('connect', 'Run a simple Node Server', function(){ var options = this.options(); // Tell Grunt this task is asynchronous. var done = this.async(); var server = connect(); server.use(function(request, response, nxt){ ... }); server.listen(port); }); }; Now I want to use...

GruntJS and custom task: require a RequireJS module

gruntjs,requirejs,grunt-contrib-requirejs
I am quite new with GruntJS and I wonder if it is possible to have a task that loads some RequireJs modules to process them and write the result within a JS file. I describe my scenario: I have a RequireJs based project with many files. I would like to...

grunt watch and sass is not compiling. It just notices change

javascript,sass,gruntjs
I cannot figure out why my 'grunt watch' command will not compile. It is only finding that a change has been made but then it will not actually compile it into my sass. Here is my gruntfiles.js module.exports = function(grunt) { var devPath = 'dev/'; var distPath = 'dist/'; grunt.initConfig({...

generating templates with grunt - looking for a task

javascript,node.js,templates,gruntjs,task
I've got an HTML file with following content: <html> <body> <span>{{ secret }}</span> </body> </html> I'm looking for a grunt task that could take this source file, take a map of values: grunt.initConfig({ myTask: { myTarget: { src: ... dest: ... values: { secret: 'ABC' } } } }) and...

Writing multiple functions in AMD javascript module

javascript,gruntjs,amd
I am quite new to writing javascript code using AMD. I am stuck at figuring out how to write multiple functions in a file: define(function(){ return { and: function(a,b){ return (a&&b); } }; } ); I tried writing another function plus in the following way: define(function(){ return { plus: function(a,b){...

How to run multiple application on Grunt

angularjs,gruntjs,server
I have two applications say applicationA and applicationB and if I run following command on terminal grunt serve my one applicationA will up and work fine. when i need to run applicationB, first i need to stop applicationA and then i can run applicationB. If i try to run both...

How to setup grunt-babel to transpile an entire directory

gruntjs,babel,transpiler
So I have this in my gruntfile: gruntConfig.babel = { options: { sourceMap: true }, dist: { files: { "dist/server.js": "src/*.js" } } }; This correctly transpiles all the js files in src, but it overwrites dist/server.js every time. This must be really simple, but I can't seem to figure...

grunt.file write/copy with permissions

gruntjs,grunt-contrib-copy,gruntfile
Is there a way to specify the permissions of a file during a grunt.file.copy(...), except using the 'fs.chmod' after copy has finished? I will have to require the whole 'fs' module otherwise, just for changing the permissions. Will it be a lot of overhead?...

How to execute jasmine tests for node modules from grunt

javascript,node.js,gruntjs,jasmine
I want to run some Jasmine 2.x tests for node.js modules in a Grunt build. My setup looks like this: src/foo.js exports.bar = 23; spec/foo.spec.js var foo = require("../src/foo.js"); define("foo", function() { it("exports bar as 23", function() { expect(foo.bar).toBe(23); }); }); With grunt-contrib-jasmine the node module system is not available...

grunt-contrib-copy syntax for process option confusion

gruntjs,grunt-contrib-copy
I'm trying to replace some placeholders in different files as I copy. My gruntfile works fine, but adding in the process option to do the replacements, it's just not working. Below is the relevant section of my gruntfile: grunt.initConfig({ copy: { js: { files: [{ expand: true, cwd: 'src/wp-content/themes/pilau-starter/', src:...

How do I create a deploy git branch for my Yeoman project?

git,deployment,gruntjs,yeoman,branching-and-merging
I created a new project using Yeoman. Using Grunt I've created the dist directory. My whole project is on Github, https://github.com/d3a1i0/mykungfuisstrong.com, and I've created a prod branch. My question is how do I get my prod branch to have only the contents of dist instead of having the dist directory...

-bash: grunt: command not found

node.js,osx,bash,gruntjs,npm
I was using node 0.10.35 and grunt command was working fine. Now after upgrading to 0.12.3 grunt command has stopped working. OS: Mac OSX 10.10.1 node: 0.12.3 npm: 2.9.1 grunt: 0.4.5 I thought there may be problem in node installation, so I clean installed it 3-4 times I tried installing...

“Arguments to path.resolve must be strings” when calling 'gitbook build' from a Git hook

node.js,git,gruntjs,githooks,gitbook
I am trying to run gitbook build within a post-receive Git hook on my (Gitlab, Debian 7, virtual private) server. Basically I want to: checkout the bare repository to a temporary dir run gitbook build in that temporary dir sync with the webspace through rsync The post-receive script runs something...

Grunt inject CSS file into