jaymon / montage Goto Github PK
View Code? Open in Web Editor NEWA low configuration php framework
A low configuration php framework
All of this was from a file called montage assets.txt
(dated Sep 19, 2011 8:37pm) that was in my dropbox folder. No sense in keeping that random file when it can live here, I don't know how much (if any) I actually implemented of these notes or if the were anything other than ramblings
Asset handling
Asset
/Assets.php
/Asset.php
/CssAsset.php extends Asset
/JsAsset.php extends Asset
abstract class Asset {
public function getPath();
public function __toString();
}
Let's say we have a plugin that has an assets folder, then you could describe how those assets work by including a child class that extends Asset.
The Assets class will compile all assets and create Asset instances for them. How you can tell is when you grab all the pre-created Asset instances you can iterate through them and take out their paths from the compiled asset paths, then if any asset paths still remain, those need to have Asset instances automatically created for them (this might not work because if you create a CssAsset then it will try and get the absolute class using the ReflectionContainer).
Then the Asset classes will move their assets into the web/assets folder so they can be used, and the __toString() method will allow them to easily be echoed. This allows stuff like Blueprint (which is 4 or more css files) to be grouped together and to make the echoing easier.
My goal with asset management is to be able to do something like add a Blueprint plugin and then refresh the page and have blueprint be used without me having to do anything else, basically I want to write the plugin once and be able to re-use it easily.
a default method for determining order could be:
http://guides.rubyonrails.org/asset_pipeline.html
for example, let's say our plugin has these assets:
/Blueprint
/assets
Blueprint/
/screen.css
/ie.css
/liquid.css
The Assets class would convert (and move the assets to the web folder) that to:
Blueprint/screen => /web/assets/Blueprint/screen-HASH.css
Blueprint/ie => web/assets/Blueprint/ie-HASH.css
Blueprint/liquid => web/assets/Blueprint/liquid-HASH.css
Then the Asset class would look something like this:
class BlueprintAsset extends \Montage\CssAsset {
public function __construct(\Montage\Assets $assets){
$this->assets = $assets;
}
public function getNames(){
return array('Blueprint/screen','Blueprint/ie','Blueprint/liquid');
}
public function __toString(){
$ret_str = '';
$url_list = $this->getUrls(); // will call getNames() and generate urls
foreach($url_list as $url){
$ret_str .= $this->renderCss($url);
}//foreach
return $ret_str;
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.