Skip to content

Commit 99441a7

Browse files
authored
Merge pull request #70 from Jibbarth/feature/improve-docs-assetic-injector
improve doc for inject libraries
2 parents 1dc609b + 5c2385c commit 99441a7

File tree

2 files changed

+123
-1
lines changed

2 files changed

+123
-1
lines changed

Resources/doc/configuration.md

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,123 @@ troopers_alertify:
3030
translationDomain: messages
3131
contexts:
3232
...
33-
```
33+
```
34+
35+
Assetic injections
36+
------------------
37+
38+
To add libraries in your views, two ways are possible :
39+
40+
#### Use [AsseticInjectorBundle](https://github.com/Troopers/AsseticInjectorBundle)
41+
42+
Add AsseticInjectorBundle in your `composer.json`, and enable it in your `AppKernel.php`.
43+
44+
Then, add injector tag in your javascripts and stylesheets declaration :
45+
46+
```twig
47+
{% stylesheets injector="alertify-library"
48+
'@AppBundle/Resources/public/css/custom.css'
49+
%}
50+
<link rel="stylesheet" href="{{ asset_url }}" type="text/css" />
51+
{% endstylesheets %}
52+
53+
{% javascripts injector="alertify-library"
54+
'@AppBundle/Resources/public/js/custom.js'
55+
%}
56+
<script src="{{ asset_url }}"></script>
57+
{% endjavascripts %}
58+
```
59+
60+
Replace `alertify-library` by the library you want to use.
61+
62+
This is the list of available injections :
63+
- `alertify-toastr`
64+
- `alertify-noty`
65+
- `alertify-notie`
66+
- `alertify-codrops-notification`
67+
- `alertify-pushjs` - *only for javascripts injection*
68+
- `foot` : Add confirm.js and alertify.js - *only for javascripts injection*
69+
70+
#### Add the library yourself
71+
72+
This is how embed libraries in your views without AsseticInjectorBundle :
73+
74+
- For **Toastr** :
75+
```twig
76+
{% stylesheets
77+
'@TroopersAlertifyBundle/Resources/public/toastr/css/toastr.css'
78+
%}
79+
<link rel="stylesheet" href="{{ asset_url }}" type="text/css" />
80+
{% endstylesheets %}
81+
82+
{% javascripts
83+
'@TroopersAlertifyBundle/Resources/public/toastr/js/toastr.js'
84+
%}
85+
<script src="{{ asset_url }}"></script>
86+
{% endjavascripts %}
87+
88+
```
89+
90+
- For **PushJs** :
91+
```twig
92+
{% javascripts
93+
'@TroopersAlertifyBundle/Resources/public/push.js/push.min.js'
94+
%}
95+
<script src="{{ asset_url }}"></script>
96+
{% endjavascripts %}
97+
98+
```
99+
100+
- For **noty** :
101+
```twig
102+
{% stylesheets
103+
'@TroopersAlertifyBundle/Resources/public/noty/css/jquery.noty.css'
104+
%}
105+
<link rel="stylesheet" href="{{ asset_url }}" type="text/css" />
106+
{% endstylesheets %}
107+
108+
{% javascripts
109+
'@TroopersAlertifyBundle/Resources/public/noty/js/jquery.noty.js'
110+
%}
111+
<script src="{{ asset_url }}"></script>
112+
{% endjavascripts %}
113+
114+
```
115+
116+
- For **notie** :
117+
```twig
118+
{% stylesheets
119+
'@TroopersAlertifyBundle/Resources/public/notie/notie.css'
120+
%}
121+
<link rel="stylesheet" href="{{ asset_url }}" type="text/css" />
122+
{% endstylesheets %}
123+
124+
{% javascripts
125+
'@TroopersAlertifyBundle/Resources/public/notie/notie.js'
126+
%}
127+
<script src="{{ asset_url }}"></script>
128+
{% endjavascripts %}
129+
130+
```
131+
132+
- For **Codrops notification**
133+
```twig
134+
{% stylesheets
135+
"@TroopersAlertifyBundle/Resources/public/codrops-notification/css/ns-default.css",
136+
"@TroopersAlertifyBundle/Resources/public/codrops-notification/css/ns-style-bar.css",
137+
"@TroopersAlertifyBundle/Resources/public/codrops-notification/css/ns-style-attached.css",
138+
"@TroopersAlertifyBundle/Resources/public/codrops-notification/css/ns-style-growl.css",
139+
"@TroopersAlertifyBundle/Resources/public/codrops-notification/css/ns-style-other.css"
140+
%}
141+
<link rel="stylesheet" href="{{ asset_url }}" type="text/css" />
142+
{% endstylesheets %}
143+
144+
{% javascripts
145+
"@TroopersAlertifyBundle/Resources/public/codrops-notification/js/classie.js",
146+
"@TroopersAlertifyBundle/Resources/public/codrops-notification/js/modernizr.custom.js",
147+
"@TroopersAlertifyBundle/Resources/public/codrops-notification/js/notificationFx.js"
148+
%}
149+
<script src="{{ asset_url }}"></script>
150+
{% endjavascripts %}
151+
```
152+

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"symfony/class-loader": "~2.1",
2525
"phpunit/phpunit": "~5.7"
2626
},
27+
"suggest": {
28+
"troopers/assetic-injector-bundle": "For Inject libraries in your views easily"
29+
},
2730
"autoload": {
2831
"psr-0": { "Troopers\\AlertifyBundle": "" }
2932
},

0 commit comments

Comments
 (0)