orchardcmsorchardcms-1.9

How do I use / utilise the Assets.json file in the Themes directory?


I am starting a new Theme from scratch and have a file called 'Assets.json' in the root directory.

It maps the LESS file from the 'Assets' directory to a CSS file in the 'Styles' directory - great.

Can anyone point me in the right direction as to how I can make use of this, as it's exactly what I want but can't find any information on how to use it.

Thanks!


Solution

  • The Assets.json file is a way to plug into the default gulp script that is provided with Orchard. This script is able to process .less files (and others) in order to generate minified and non-minified versions of scripts or stylesheets, and bundle your grouped assets. This way you don't have to create your own gulp file for each module, just describe the assets you want to be processed and it will do it automatically.

    It will also watch the files you described and re-process them when they have changed. The simplest way to use them is to copy-paste one from the core modules, and place them in your own module or theme. Then just run the main gulp file, or enable its support in Visual Studio. You can run npm install from the root folder for this.