cedr-library
Cedr-library - loader library blocks.
Installation
$ npm install --save cedr-library
Usage
Used in conjunction with cedr. Needed to create object library from the folder blocks. It is possible to upload multiple folders with the subsequent redefinition in a single library.
const library = ; ;
The folder structure of the library
Lib1
block1
- block1.html // template block
- __item.html // template element item of block
- __something.html // template element something of block
- mystyle.css //block style
- myscript.js //block script
block2
block3
block4
For templates it is important to have the correct file name. Name starting with '__' refers to the block element. The name coincides with the name of a block refer to the block template.
For stylesheets and scripts it is important file extension:
- scripts: 'js', 'coffee', 'ts'.
- styles: 'css', 'sass', 'less', 'scss', 'pcss'.
The location of the files in the folder of block does not matter.
API
cedr-library can be called with one and more path to library.
cedr-library(libraries, callback)
libraries
Type: String[]
or String
Path to library or Array of paths to libraries
callback
Type: Function
Called when the library is loaded. Argument is passed the library.
License
MIT © antitim