Picture of Mathew Gancarz
Grunt build sometimes not needed to see changes?
by Mathew Gancarz - Friday, 31 January 2014, 5:26 PM
 

Hi everyone, this might be a stupid question but I'll ask anyways.

I noticed when trying to edit the course, when I'm working directly in the \src\course\en\blocks.json file and am previewing my work using the grunt server-scorm command, once I save the blocks.json file, the changes show up as soon as I hit refresh in the  http://localhost:9001/main.html window.

Before I would use grunt build to re-build the course each time I made changes, but this seems like a much faster way to work. Is this a valid way of working or am I risking breaking things horribly?

Picture of Kev Adsett
Re: Grunt build sometimes not needed to see changes?
by Kev Adsett - Friday, 31 January 2014, 6:08 PM
 

Hi Mathew, 

The server-scorm command is set up to show the contents of the build folder, so the fact you can see your changes happening in real time, suggests to me that you're editing in the build folder, not src.

I would be wary that you are in fact in \src\course\en\blocks.json as you say and not \build\course\en\blocks.json.

If it is the latter and you run the grunt process, all your hard work will be lost as it will overwrite the contents of build with that from src, so yeah that could be considered a risk! :)

Picture of Mathew Gancarz
Re: Grunt build sometimes not needed to see changes?
by Mathew Gancarz - Friday, 31 January 2014, 7:17 PM
 

Hi Kev, I've double checked and for sure I am editing in \src\course\en. However I have now tested and verified that while grunt server or grunt server-scorm is running in the background, any changes I make in \src\course\en are immediately copied to \build\course\en

I've attached a picture of what windows explorer looks like of both directories. In this case at 2:11 PM I modified \src\course\en\blocks.json and hit save.

Immediately all of the time stamps in \build\course\en were updated to 2:11 PM.

When grunt server is NOT running, the last modified time stamps in \build\ are not updated until I do a grunt build.


Picture of Mathew Gancarz
Re: Grunt build sometimes not needed to see changes?
by Mathew Gancarz - Friday, 31 January 2014, 7:24 PM
 

Interestingly, it looks like it even copies the contents of images and videos folder, keeping everything in \build\course in sync with \src\course

I copied an image in \src\course\en\images using windows explorer, just pasting it into the same folder and a fraction of a second later, the same copy of the image showed up in \build\course\en\images

Picture of Daryl Hedley
Re: Grunt build sometimes not needed to see changes?
by Daryl Hedley - Saturday, 1 February 2014, 6:49 AM
 

Hey Mathew,

 

When you run either 

$ grunt server or $ grunt server-scorm, you'll see in the Gruntfile.js in the root of your course has a watch command. This watch command is looking over your files and will push any changes to the build folder. This watch command has been optimised so it only runs grunt commands based upon your changes as we found the build process too long if you made a change to a file that did not need the full build process.

If you're interested - have a look at some other commands like

$ grunt dev - enables source mapping in chrome, Firefox needs an extension.

 

$ grunt build - minifies all your files ready for production.

 

hope this helps.

thanks,

Daryl

Picture of Mathew Gancarz
Re: Grunt build sometimes not needed to see changes?
by Mathew Gancarz - Monday, 3 February 2014, 2:34 PM
 

Ah, Nice Daryl, that is very handy!

Could I suggest that this information be added to the https://github.com/adaptlearning/adapt_framework/wiki/Setting-up-your-development-environment pages? I could add it myself also but I'm not sure yet what your community contribution policy is and don't want to step on any toes.

me
Re: Grunt build sometimes not needed to see changes?
by Sven Laux - Monday, 3 February 2014, 3:17 PM
 

Hi,

thanks, Mathew! I'm keen that we figure out a way to get you (and others) to be comfortable to add/change this.

Daryl, Ryan, could you support Mathew accordingly?

If we get this right and enable people, we scale up, which gives the project the best chances for success.

Thanks for offering, Mathew! Thanks so much for your interest and feedback and keen to get you 'sucked in' :-) 

Sven