Created
March 26, 2016 16:28
-
-
Save frostbitten/6db3fcf5309d3349e954 to your computer and use it in GitHub Desktop.
UserFrosting - Stolz Assets Plugin
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
{ | |
"name": "userfrosting-plugin-stolz-asssets", | |
"type": "project", | |
"description": "Integrates Stolz's Assets Manager", | |
"license" : "MIT", | |
"require-dev": { | |
}, | |
"require": { | |
"stolz/assets" : "*", | |
} | |
} |
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
<?php | |
namespace UserFrosting; | |
$app->assets = new \Stolz\Assets\Manager; | |
$app->assets->config([ | |
'css_dir' => '/css', | |
'js_dir' => '/js' | |
]); | |
$twig = $app->view()->getEnvironment(); | |
$twig->addGlobal( "assets", $app->assets ); | |
// register collections, similar to a 'page-group' | |
$app->assets->registerCollection("sapphire-theme", [ | |
"my-sapphire-theme.css", | |
"my-sapphire-scripts.js", | |
]); | |
?> |
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
{# these statements must come first #} | |
{% do assets.add('https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css') %} | |
{% do assets.add('https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js') %} | |
{% do assets.add('my-local-styles.css') %} | |
{% do assets.add('my-app.js') %} | |
{% do assets.add('sapphire-theme') %} {# a colection #} | |
{# printing the <script or <link tags #} | |
{# Change {'pipline' : true } for a single, concatenated file #} | |
{{ assets.config({'pipeline' : false}).css() | raw }} | |
{{ assets.config({'pipeline' : false}).js() | raw }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment