Assets loading with themes and skins supported#191
Open
Assets loading with themes and skins supported#191
Conversation
added 2 commits
September 15, 2018 23:43
1) if `uri` is start with `/`, it'll try to load asset from document root
```php
// Register specific services for the module
public function registerServices(Di $di)
{
$di->assets->setOptions([
'source' => __DIR__ . '/Skin/Default/',
'target' => 'min/',
'minify' => 3
]);
}
// load from module dir/Skin/Default/css/style.css
$this->assets->addCss(['css/style.css']);
// load from document_root/Skin/Default/css/style.css
$this->assets->addCss(['/Skin/Default/css/style.css']);
```
2) always store the min files in the document_root/target dir
added 2 commits
September 16, 2018 13:00
place min file to document root
Contributor
Author
|
@mruz please review the new features i just add to comment. i'll trying to implement it soon if you agree with that. and after that i think Ice is ready for new release and good for deploying to production |
mruz
reviewed
Oct 4, 2018
added 10 commits
October 5, 2018 14:11
get/set cache the prepared resources
Contributor
Author
|
@mruz review plz |
`type` parameter change from `text/css` or `text/javascript` to `css` or `js` ```php $assets->addCss(['css/style.css', 'type' => 'css']) ->addCss(['js/script.js', 'type' => 'js']) ``` but not ```php $assets->addCss(['css/style.css', 'type' => 'text/css']) ->addCss(['js/script.js', 'type' => 'text/javascript'])
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assets loading with themes and skins supported. assume that different apps (or plugins) are independent with each others but share the same basic modules and public resources
A) asset cases: there are stylesheet files in public
cssshare by all appsand app specific stylesheet locate in its directory. e.g.
B) loading source and target
minify
public/css/style.csstopublic/min/css/style.min.cssminify
account/default/css/account.csstopublic/min/css/account.min.csspublic/default/css/account.cssnot exists,copy
account/default/css/account.csstopublic/default/css/account/default/css/account.csstopublic/default/css/C) implement
uriis start with/, it'll try to load asset from document rootONE MORE THING
typeparameter change fromtext/cssortext/javascripttocssorjsbut not