I need to create my own UI library (mostly
.less files, but also images and
.js) which will be used in multiple custom modules and themes. I thought I will just add my files to Magento UI library which is located under
But first of all, is it allowed (and is it a good practice) to add custom files in
If I add there custom files, should I create there my own folder (e.g. with my company name) such as
/lib/web/companyto keep all my custom files separated from Magento default files?
lib/ ├── web/ │ ├── css/ │ │ ├── source/ │ ├── fonts/ │ ├── jquery/ │ ├── company/ │ │ ├── css/ │ │ │ ├── source/ │ │ ├── fonts/ │ │ ├── jquery/
Or should I create custom folder inside each of the default folders? Like this:
lib/ ├── web/ │ ├── css/ │ │ ├── source/ │ │ ├── company/ │ │ │ ├── source/ │ ├── fonts/ │ │ ├── company/ │ ├── jquery/ │ │ ├── company/
I've checked documentation about UI library, but it's not clear to me where custom files should be placed: https://github.com/magento/magento2/blob/2.0/lib/web/css/docs/source/README.md
Example 1 (link):
If variables are common for couple themes it should be located in global lib in _variables.less file
I assume we should never edit the default the core files. So do they mean that I should create my own folder for the file with custom variables? Where exactly?
Example 2 (link):
Extends that used in more than one theme should be saved in lib
lib/source/utilities.less(will be separated into utilities folder)
This suggests that custom mixins should be placed in a new file
utilities.less inside a new sub-directory
/lib/web/css/source/lib/source. Is that correct?
But they don't say if I should create my own folder there.