Grunt Watch command - gruntjs

Trying to set up Grunt with Roots Bootstrap Starter Template - Installation of grunt seemed to go perfectly fine - but when I run 'grunt watch' and go to change my .less files nothing happens in the terminal and grunt doesn't compile my changes. Here is my terminal output after installing > running grunt > and then running 'grunt watch'.
Jeffs-MacBook-Air:roots-master jeffsee55$ grunt
Running "clean:dist" (clean) task
Cleaning assets/css/main.min.css...OK
Cleaning assets/js/scripts.min.js...OK
Running "less:dist" (less) task
File assets/css/main.min.css created.
Running "uglify:dist" (uglify) task
File "assets/js/scripts.min.js" created.
Running "version" task
Versioning assets/css/main.min.css...OK
Versioning assets/js/scripts.min.js...OK
"lib/scripts.php" updated with new CSS/JS versions.
Done, without errors.
Jeffs-MacBook-Air:roots-master jeffsee55$ grunt watch
Running "watch" task
Waiting...
As I said, I then go to make changes to anything in ANY of my .less files which are located in assets/less. Any tips on troubleshooting? Perhaps reinstalling EVERYTHING including node.js?

Related

Why does grunt allow global installations?

I've installed both the grunt-cli and grunt globally using the -g option.
However when I try and run grunt I get this error:
grunt --gruntfile /Users/a/root/config/Gruntfile.js
grunt-cli: The grunt command line interface. (v0.1.13)
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
This is confusing as it seems to say that you are suppose to do a local install.
It seems contradictory actually. I clearly have a grunt file in place.
Grunt-cli is installed globally so that the grunt command is available to be run from any location on your system. Without the global installation, you would need to rely on somewhat abstract methods of running local grunt installs (npm run-script and friends), which are clunky for this use.
The entire point of the global install is only to load and run a local Gruntfile.js using the locally installed version of Grunt. The error message indicates this:
either a Gruntfile wasn't found or grunt hasn't been installed locally to your project.
In other words, to run Grunt, you need to create a Gruntfile.js and you must have a local copy of Grunt installed to your project alongside the file. The CLI is just there to kick off the process without troublesome fiddling.

Running 'grunt' command on mean.js app just stalling

I am following the installation guidelines as described on mean.js.org Everything seemed to install fine. I have all prereqs installed. I ran npm install after cloning the github repo and then tried to run grunt and I didnt get any errors however It seems to just be stalling on the command line. Last message on the command line is the "debugger is running on port 5858" and then it just sits there.
After some time the message [nodemon] watching 51,839 files - this might cause high cpu usage. To reduce use "--watch" comes up. I am on windows 10 and have all the latest versions of node,npm,grunt and mean.js. I am running the command line as admin.
Mean.js should be running on localhost:3000 but it is not.
This is intended.
There is an application invoked by the grunt command and running in background, watching your files for changes. In default configuration: nodemon and grunt-watch.
This will execute specific tasks based on the files you edited, such as linting JS files or compiling LESS files.
The cmd will probably show something when you edit files in the projects directory.

Grunt+Foundation: css/foundation.css created, content [object Object]

I just got started with Bolt.cm (CMS) which comes along with Foundation for frontend.
I've installed Node, NPM, Node-sass, Bower and Grund and started a "grunt watch" in the theme directory.
Grunt is running ("waiting") and when I edit a file in the scss folder (the one from the theme of course, not from the bower_components, I know I should not edit them) the task is successfully executed:
Running "sass:dist" (sass) task.
File "css/foundation.css" created.
Done, without errors.
Theme & versions:
I copied this theme to modify it locally: https://github.com/bolt/base-2014
Grunt version is grunt-cli v0.1.13
NPM version 1.3.10
bower version 1.4.1
The problem
When i open css/foundation.css, the file does not contain CSS code, but only [object Object] as text.
This is the output when i run grunt --verbose:
grunt --verbose
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-sass" local Npm module tasks.
Reading /var/www/bolt/theme/avoe/node_modules/grunt-sass/package.json...OK
Parsing /var/www/bolt/theme/avoe/node_modules/grunt-sass/package.json...OK
Loading "sass.js" tasks...OK
+ sass
Registering "grunt-contrib-watch" local Npm module tasks.
Reading /var/www/bolt/theme/avoe/node_modules/grunt-contrib-watch/package.json...OK
Parsing /var/www/bolt/theme/avoe/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch
Loading "Gruntfile.js" tasks...OK
+ build, default
No tasks specified, running default tasks.
Running tasks: default
Running "default" task
Running "build" task
Running "sass" task
Running "sass:dist" (sass) task
Verifying property sass.dist exists in config...OK
Files: scss/foundation.scss -> css/foundation.css
Options: includePaths=["bower_components/foundation/scss"], outputStyle="compressed", sourceComments="none"
Writing css/foundation.css...OK
File "css/foundation.css" created.
I managed to fix this issue by going into node_modules folder, removing and reinstalling grunt-sass and node-sass:
rm -rf node-sass
rm -rf grunt-sass
npm install node-sass
npm install grunt-sass
The reinstallation of grunt sass updated my foundation-libsass-template repo, which is where i think the issue may have lay.
It may be that you don't even need to touch node-sass, so perhaps give grunt-sass a go first.
Hope this helps.

running grunt task as configuration in webstorm

In webstorm, running grunt serve from the terminal works flawlessly and presents me with a webpage. However, when I make a configuration and run that, there's an error concerning SASS to CSS compilation:
Running "concurrent:server" (concurrent) task
Warning: Running "compass:server" (compass) task
Warning: You need to have Ruby and Compass installed and in your system PATH for this task to work. More info: https://github.com/gruntjs/grunt-contrib-compass Use --force to continue.
Aborted due to warnings.
which I do not understand, as I'm using the same settings (described here)
Seems WebStorm doesn't see your terminal environment when being started from shortcut. Pleasee try editing the launcher as suggested in https://devnet.jetbrains.com/message/5513463#5513463 - does it help?

I'm running into this issue when trying to grunt serve. Could anyone help me solve this issue

roys-mbp:gucci Filthy$ grunt serve
Running "serve" task
Running "clean:server" (clean) task
Running "concurrent:server" (concurrent) task
Warning: Running "sass:server" (sass) task
Warning: /Users/Filthy/Documents/gucci/app/styles/main.scss:4: error: file to import not found or unreadable: '../../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss'
Use --force to continue.
Aborted due to warnings.
Execution Time (2014-05-07 07:06:54 UTC)
loading tasks 3ms ▇▇▇▇▇▇▇▇▇▇▇▇▇ 27%
sass:server 7ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 64%
Total 11ms Use --force to continue.
Aborted due to warnings.
Try running 'bower install' to install your dependencies.
I had the same problem, the path to bootstrap.scss was wrong.
Did you use the webapp generator?
Change the line 4 in main.scss from
'../../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss'
to
'../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss'
or to whatever the path to the bootstrap.scss may be.
I had the same problem. I was thinking npm and bower dependencies was installed, but the installation didn't end.
To fix it:
npm install
bower install
That fixed my problem.
There is a problem in your sass file, use this source
#import "bootstrap-sass-official/assets/stylesheets/_bootstrap.scss";
Open cmd promt
go to the project folder
type -> bower install and enter
it will install bower components
and show option to which version need to be installed
then the problem solved
Its working fine for me try it.....

Resources