Skip to main content

Is there an easy way to set up a grunt task so that I can push specific pages back to the server?

I’d like to do something like this:


grunt.initConfig({ 'skuid-push':{&nbsp; &nbsp; &nbsp; 'options': orgOptions,<br>&nbsp; &nbsp; &nbsp; 'production':{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'files':{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src: :'skuidpages/Optimize*', 'skuidpages/Cleanup*']<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; 'specific':{<br>&nbsp; &nbsp; &nbsp; &nbsp; 'files':{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src: :'skuidpages/'<b> + n</b>]<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; } });

grunt.registerTask('push-specific-page', ,'skuid-push:specific']);

And then run something like this in the console:


grunt skuid-push:specific("Module1_PageName");


But it’s not clear to me if there’s actually a way to do that without hard-coding the page into the gruntfile each time. Any pointers on this?

Matt - Take a look at grunt.option (http://gruntjs.com/api/grunt.option).  I think this should give you what you are looking for.


Matt,
Barry is correct. grunt.option would be your best bet. You’re snippet above wouldn’t have change much at all. 

grunt.initConfig({


'skuid-push':{'options': orgOptions,<br>&nbsp; &nbsp; &nbsp; 'production':{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'files':{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src: s'skuidpages/Optimize*', 'skuidpages/Cleanup*']<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; 'specific':{<br>&nbsp; &nbsp; &nbsp; &nbsp; 'files':{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src: s'skuidpages/'<b> + grunt.option('page')</b>]<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; } });


This will give you the ability to push any single or number of pages that you specify at runtime.  The command would look something like this:


grunt skuid-push:specific --page="Module_SomeSinglePage.xml" 

or


grunt skuid-push:specific --page="AllPagesInModule_*" 




Thanks, Ethan.


Matt, is it possible to set up a grunt task to pull down page by page?


Not that I’m aware of. @Ethan?