Small Grunts...

Small Grunts...

by Mary Evans -
Number of replies: 15
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

module.exports = function(grunt) {
  grunt.registerTask('pig', 'My "pig" task.', function() {
    grunt.log.writeln('Oink! Oink!');
  });
};

Average of ratings: -
In reply to Mary Evans

Re: Small Grunts...

by Frankie Kam -
Picture of Plugin developers

Hi Mary

I'm not sure what to make of this...

Frankie

In reply to Frankie Kam

Re: Small Grunts...

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

It's all related to a new concept of how things are done in Moodle with relation to jQuery...or put another way...

Things you need to know before Moodle 2.9 is released!

Please Read: https://moodle.org/mod/forum/discuss.php?d=312375

I am struggling with it at the moment but having fun on the way!

Cheers

Mary

In reply to Mary Evans

Re: Small Grunts...

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
module.exports = function(grunt) {
  var np = grunt.option('pigs') || 12;
  grunt.registerTask('pinkarrows', 'The pink arrows.', function() {
    console.log('A formation of ' + np + ' flying pigs.');
  });
  grunt.registerTask("default", ["pinkarrows"]);
};

grunt -pigs=14

In reply to Gareth J Barnard

Re: Small Grunts...

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

(^@^)~

C:\wamp\www\moodle29>grunt
Running "pinkarrows" task
A formation of 12 flying pigs.

Done, without errors.

In reply to Mary Evans

Re: Small Grunts...

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Got up at 9am and just managed to run concat and uglify using grunt to gather all the jquery plugins for a theme and put them all into a .min.js file. - Yeah!

Ah...but why did it take me so long? Because I missed adding a comma , after a } 

That part was the most frustrating of all considering I have got this far and learned so much more about 'grunt'

I am so pleased with myself I had to share it!

I need to go create myself a Badge now! LOL

Thanks for listening,

Mary

In reply to Mary Evans

Re: Small Grunts...

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Just updating this...May 2015 to 22 November 2015...over six months have passed and things are looking good so far.

Well apart from this after running Grunt in Moodle 3.0 on my XP Laptop.

I'm not sure what all this means but at least it did not crash.

shifter [info] done racing, the gears are toast
shifter [info] finished in 3 minutes, 46 seconds, pretty fast huh?
>> Shifter build complete.

Running "jshint:files" (jshint) task

   lib/amd/src/form-autocomplete.js
    375 |    var updateSelectionList = function(options, state, originalSelect)
{
                 ^ 'updateSelectionList' was used before it was defined.
   lib/amd/src/templates.js
    103 |    var partialHelper = function(name) {
                 ^ 'partialHelper' was used before it was defined.
    283 |    var getTemplate = function(templateName, async) {
                 ^ 'getTemplate' was used before it was defined.

>> 3 errors in 19 files
Warning: Task "jshint:files" failed. Use --force to continue.

Aborted due to warnings.

Moodle version:

$release  = '3.0 (Build: 20151116)'; // Human-friendly version name

In reply to Mary Evans

Re: Small Grunts...

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Mary,

  • Did you run 'grunt' in a Node.js command prompt?
  • Did you run 'npm install' in the Moodle root beforehand?
  • What command did you type and in what path location?

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Small Grunts...

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Then again, some issues!  But with other things, mine, others and core....

Attachment 2015-11-22 13_21_34-Node.js command prompt.png
In reply to Gareth J Barnard

Re: Small Grunts...

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

But pragmatically this is to do with YUI and shifter and not LESS or AMD, so wait for MDL-51582 to land.

In reply to Gareth J Barnard

Re: Small Grunts...

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi,

Thanks for testing it...

Here is what I did:

Well after refreshing my memory reading through a tutorial I found called Small Grunts I managed to first concat two .js files from one directory into another. So feeling brave I decided to try out Moodle. So using node.js command prompt I changed directory to my Moodle on ../../wamp/www/moodle then did the following...

npm install

npm -g grunt-install

Then I ran ...

grunt

I wasn't testing the CSS aspect as I know that is still to be approved and tested. I was just seeing if the if the root Gruntfile.js worked in Windows...so the fact it works in XP was for me a major break through.

I will try out MDL-51582 just out of curiosity.

Cheers

Mary

In reply to Mary Evans

Re: Small Grunts...

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Mary,

You don't need 'npm -g grunt-install' as grunt is installed by the effect of this line: https://github.com/moodle/moodle/blob/MOODLE_30_STABLE/package.json#L6

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Small Grunts...

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Sorry I meant npm install -g grunt-cli

https://docs.moodle.org/dev/Grunt

In reply to Mary Evans

Re: Small Grunts...

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Mary,

Oh, I see.  Please do say how you get on with MDL-51582 and I'll see what I can do to help.

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Small Grunts...

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

It appeared to work OK when I tested it, using 'grunt less', earlier this evening. I left a note and a screenshot of the results. However, the single 'grunt' command, just churned out a load of errors and stopped like it did for you yesterday.

Anyway I am happy it is working in Win10.

Thanks for your help.

Cheers

Mary