Create minified versions of custom widget scriptsPREREQUISITES: Before you proceed with this tutorial, ensure you have configured your environment to run Grunt:
- Install Node.js. For more information see: NodeJS download.
- Install the grunt CLI by runing
npm install -g grunt-cli in your Command Prompt. For more information see: GruntJS Getting Started.
When you develop your custom MVC widgets you can benefit from Sitefinity's ability to automatically load a minified version of a script, if one is found in the folder, where the script is referenced. To produce a minified version of your scripts, follow these steps:
In the current folder (the root folder of your custom MVC widget), create a new filecalled
gruntfile.js with the following contents:
- In the current folder create a new file called package.json witht he following contents:
- Open the Command Prompt, navigate to the root folder of your custom MVC widget and run the following commands: