simplette/loader
Composer 安装命令:
composer require simplette/loader
包简介
Loader for styles and scripts.
README 文档
README
An implementation of simple assets loader - for building your styles and javascripts on the fly. Thank to this library, you can simplify your workflow with Nette Framework's frontend.
Requirements
This library requires PHP 7.1 or higher. Simplette Loader library is designed for Nette Framework version 3.0 and higher.
Installation
The best way to install this library is using Composer:
$ composer require simplette/loader
Documentation
Firstly, register extensions. For more information about configuration see the class definition. This library (as all libraries from Simplette) is meant to be as simple as possible.
extensions: style: Simplette\Loader\Style\StyleLoaderExtension script: Simplette\Loader\Script\ScriptLoaderExtension
Now you can define your own list of styles, scripts, configure each part of loader, etc.
See example configuration:
style: debugger: %debugMode% # or just set true/false genDir: assets/gen files: admin-sb: # you can combine scss and css files - %appDir%/Modules/AdminModule/styles/admin-sb.scss - %appDir%/Modules/AdminModule/styles/daterangepicker.css admin-editor: - %appDir%/Modules/AdminModule/styles/codemirror.css - %appDir%/Modules/AdminModule/scripts/vendor/codemirror/addon/display/fullscreen.css - %appDir%/Modules/AdminModule/styles/codemirror.scss # ... script: debugger: %debugMode% compiler: minify: FALSE # turn off minification / there can be possible to set other compiler parameters genDir: assets/gen files: admin-sb: - %appDir%/Modules/AdminModule/scripts/vendor/bootstrap.bundle.min.js # files *.min.* would not be minified again # ... - %appDir%/Modules/AdminModule/scripts/sb-admin-2.js # ... admin-search: # ... - %appDir%/Modules/AdminModule/scripts/search.js admin-nette: - %appDir%/../vendor/nette/forms/src/assets/netteForms.min.js - %appDir%/Modules/AdminModule/scripts/vendor/nette.ajax.js # ... - %appDir%/Modules/AdminModule/scripts/init-nette.js admin-editor: - %appDir%/Modules/AdminModule/scripts/vendor/codemirror/codemirror.js # ... - %appDir%/Modules/AdminModule/scripts/init-editor.js # ...
Then you can use it in your latte templates like this:
<link rel="stylesheet" n:style="admin-sb"/> <script n:script="admin-sb"></script>
Contributing
This is an open source, community-driven project. If you would like to contribute, please follow the code format as used in current sources and submit a pull request.
Advanced documentation will be added in the future. But if you look on my source codes, you will understand what you can do with this small (but powerful) library.
See also other libraries and some older work if you are looking for inspiration.
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-09-13