Hi guys,
is there a way to grunt localy one plugin for a local build without having to grunt all moodle ? the global grunt is quite long !!
Hi Valery,
If you are building AMD modules you can cd into the amd dir of your plugin and run grunt to build just the modules for that plugin. If you are building YUI modules you cd into the yui/src/whatever directory of your plugin and run grunt to build just that YUI module. I think similar options are available for compiling CSS, but I'm not as familiar with that.
https://docs.moodle.org/dev/Grunt
Hope that helps.
That sounds good Sam,
as i am working daily on 170 plugins, i need to automate decently all the upstream pre-production chain and try to optimize compile time each time i change a coma in a script.
I'm going to try to implement and systematize local .js and .json files to see if this copes my needs.
Well, does not seem to work so straight :
without any action and cding to the module's root and running "grunt amd" is still running a global amd compilation.
What i did next :
I reinstalled grunt in the plugin's directory with a local package.json file containing the plugin name. This creates a new node_modules in the plugin you have to exclude from version system.
Now trying to run grunt in the plugin root still explores everything... and most ennoying are those third party plugins that do not fuly comply to verification rules...
The essential purpose is to get those "build" min scripts compiled as they are now mandatory from 3.4 ahead.
without any action and cding to the module's root and running "grunt amd" is still running a global amd compilation.
You need to cd into the amd folder of your module root, i.e. dirroot/blocks/foo/amd before running grunt amd - this will compile only your plugins AMD source files
tried that too, but seems still compiling scripts located in the theme...
Hi Valery,
I've always found the core grunt too long winded so wrote my own local plugin version for minifying the AMD files, so e.g:
Tested on windows only, run in plugin root.
Gareth
Use grunt watch. It will then only work on the thing that's changed when you save the file.