FAQ Database Discussion Community


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...

What does slash dot refer to in a file path?

windows,git,gruntjs,filepath,slash
I'm trying to install a grunt template on my computer but I'm having issues. I realized that perhaps something different is happening because of the path given by the Grunt docs, which is %USERPROFILE%\.grunt-init\ What does that . mean before grunt-init? I've tried to do the whole import manually but...

Yeoman - Gruntfile.js generates source map at build but deletes it after any changes

sass,gruntjs,yeoman,yeoman-generator,gruntfile
I installed Yeoman with angular generator, and it created Gruntfile.js. The problem is that after launching the webserver in the terminal with: grunt serve Yeoman generates main.css with in the end the reference of the source map /*# sourceMappingURL=main.css.map */ But after changing any scss the watch routine regenerates it...

Grunt tasks stuck in endless loop

javascript,node.js,gruntjs,npm,grunt-contrib-concat
Working on putting together a base Gruntfile.js for some upcoming projects. Starting in on a new computer so everything has been a fresh build. Installed Node and NPM using Homebrew, and then installed Grunt globally, as well as in my local directory. Here is my package.json: { "name": "timespent-prototype", "version":...

When using Libsass/Grunt is there a way to watch files on the fly?

css,sass,gruntjs,zurb-foundation-5,libsass
I have installed Foundation 5 using >gem install foundation And then creating a new project using the command >foundation scratch --libsass The main reason being is that I'm on Windows and I really don't need/want to be using compass. I know that after I make changes to my sass files...

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...

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...

Combine js files from different directories via config using grunt

javascript,gruntjs,npm,minify
I'm using grunt and sass and I'm looking for a sass-like feature to import any JS file I like to and combine them to 1 file via some config depending on the directory I am in. Example directories: startpage file1.js file2.js importjs.json page1 file3.js file4.js importjs.json global global1.js global2.js Each...

Grunt hangs on uglify

node.js,gruntjs,minify,grunt-contrib-uglify
I am trying to minify a little angular script, but for some reason uglify just hangs indefinitely. JSHint runs fine and completes if I add it into the task list, and then it hangs on uglify. Here is my Gruntfile: module.exports = function (grunt) { // Project configuration grunt.initConfig({ //...

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:...

need to generate css from scss file on windows 8.1 using gruntjs compass

css3,sass,gruntjs,grunt-contrib-watch
I am working on a and facing problem to generate tabs.css file from the tabs.scss that is being provided . I have tried all possible options. I am able to successfully generate tabs.js under dist/ folder but failing to generate tabs.css. I have run the following commands also: npm install...

Strange npm behavior when installing packages like grunt

node.js,gruntjs,npm,gulp,bower
I run the following command in my bash and I get the related results: [email protected]:~$ sudo npm install -g grunt-cli /usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt [email protected] /usr/local/lib/node_modules/grunt-cli ├── [email protected] ├── [email protected] ([email protected]) └── [email protected] ([email protected], [email protected]) and [email protected]:~$ grunt /usr/bin/env: node: No such file or directory I also have try to install...

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...

How to output timestamp when node.js server is restarted via grunt-nodemon?

javascript,node.js,gruntjs,nodemon
I have simple hello world nodejs express application and I just added grunt-nodemon that should watch changes on *.js files. Here is the console output I get when I run grunt and then change some .js file: Running "nodemon:dev" (nodemon) task [nodemon] v1.3.7 [nodemon] to restart at any time, enter...

Getting undefined with custom function execution in grunt task

gruntjs
Try to execute below custom task: 'use strict'; module.exports = function(grunt) { grunt.initConfig({ log: { one: [1, 2, 3], two: "Hello World", three: true, four: { five: function() { grunt.log.writeln("Hi"); }, six: function() { grunt.log.writeln("Welcome"); } } } }); grunt.registerMultiTask('log', 'Log stuff', function() { grunt.log.writeln(this.target + ": " + this.data...

Grunt build is leaving out a new directory in 'Dist'

angularjs,build,gruntjs,yeoman,yeoman-generator-angular
I'm new to angular and I'm trying to do a grunt build of my Yeoman scaffolded app. At one point in my project I created a new sub directory of "app/". When I do a Grunt build this directory is not included in the "dist" project and it's causing errors....

Organize multi-app project with share code

git,github,gruntjs,openui5,sapui
I have a serious problem (!!!) about organizing my develop environment; I have two apps: app1 and app2. This apps are written using OpenUI5 (but this detail is not important) app1 and app2 are similar and share some code (for example the code to login). I use git (with git-flow)...

Asynchronous tasks in grunt.registerTask

gruntjs,karma-runner
I need to call two functions within grunt.registerTask, but the second function has to be called after the first function is done. So I was wondering if we can use callbacks or promises or other asynchronous mechanisms within grunt.registerTask. (More specifically, I need to launch karma in my first function...

Yeoman angular grunt-serve vs http-serve

angularjs,gruntjs,npm,yeoman,http-server
I've just used Yeoman to create an Angular project that looks great when I run grunt serve. But then I decided to view it by running http-server, and the page gets displayed without the formatting and without the images. Does anyone know why that is and if I'll run into...

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){...

SailsJS: Requiring Assets, Such As, sails.io.js

javascript,node.js,socket.io,gruntjs,sails.js
As the problem is short & sweet, I'll keep the question so. CAN'T LOAD ASSETS. Using Sails.js (v0.11.n). Can't load assets... That's about it... I'm trying to load sails.io.js -- or now even just assets/alert.js. <script type="text/javascript" src="/js/dependencies/sails.io.js"></script> Doesn't work :( Even when I switch the src to /alert.js --...

Grunt inject CSS file into