diff --git a/docs/reference/advanced_configuration.rst b/docs/reference/advanced_configuration.rst
index 35d84181a..80d23cb3d 100644
--- a/docs/reference/advanced_configuration.rst
+++ b/docs/reference/advanced_configuration.rst
@@ -42,8 +42,11 @@ Full configuration options:
stylesheets:
# Defaults:
- bundles/sonatapage/app.css
- - bundles/sonatapage/frontend.css
javascripts:
+ frontend_stylesheets:
+ # Defaults:
+ - bundles/sonatapage/frontend.css
+ frontend_javascripts:
templates: # Required
# Prototype
id:
diff --git a/docs/reference/installation.rst b/docs/reference/installation.rst
index e0d8f87df..e0f541d0f 100644
--- a/docs/reference/installation.rst
+++ b/docs/reference/installation.rst
@@ -121,6 +121,13 @@ SonataPageBundle Configuration
not_found: [404] # render 404 page with "not_found" key (name generated: _page_internal_error_{key})
fatal: [500] # so you can use the same page for different http errors or specify specific page for each error
+ # Add custom css and js for your pages.
+ # assets:
+ # frontend_javascripts:
+ # - assets/js/your.js
+ # frontend_stylesheets:
+ # - assets/css/your.css
+
SonataAdminBundle Configuration
-------------------------------
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php
index caabb2f32..31f6bbadd 100644
--- a/src/DependencyInjection/Configuration.php
+++ b/src/DependencyInjection/Configuration.php
@@ -138,7 +138,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->arrayNode('stylesheets')
->defaultValue([
'bundles/sonatapage/app.css',
- 'bundles/sonatapage/frontend.css',
])
->prototype('scalar')->end()
->end()
@@ -146,6 +145,16 @@ public function getConfigTreeBuilder(): TreeBuilder
->defaultValue([])
->prototype('scalar')->end()
->end()
+ ->arrayNode('frontend_stylesheets')
+ ->defaultValue([
+ 'bundles/sonatapage/frontend.css',
+ ])
+ ->prototype('scalar')->end()
+ ->end()
+ ->arrayNode('frontend_javascripts')
+ ->defaultValue([])
+ ->prototype('scalar')->end()
+ ->end()
->end()
->end()
diff --git a/src/Resources/views/base_layout.html.twig b/src/Resources/views/base_layout.html.twig
index 85a070528..43e32e5bd 100644
--- a/src/Resources/views/base_layout.html.twig
+++ b/src/Resources/views/base_layout.html.twig
@@ -21,7 +21,7 @@ file that was distributed with this source code.
{% block sonata_page_stylesheets %}
{% block page_stylesheets %} {# Deprecated block #}
- {% for stylesheet in sonata_page.assets.stylesheets %}
+ {% for stylesheet in sonata_page.assets.frontend_stylesheets %}
{% endfor %}
{% endblock %}
@@ -34,7 +34,7 @@ file that was distributed with this source code.
- {% for js in sonata_page.assets.javascripts %}
+ {% for js in sonata_page.assets.frontend_javascripts %}
{% endfor %}
{% endblock %}
diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php
index 36e3dc72b..94d314b07 100644
--- a/tests/DependencyInjection/ConfigurationTest.php
+++ b/tests/DependencyInjection/ConfigurationTest.php
@@ -124,9 +124,12 @@ public function testPageWithMatrix(): void
'assets' => [
'stylesheets' => [
'bundles/sonatapage/app.css',
- 'bundles/sonatapage/frontend.css',
],
'javascripts' => [],
+ 'frontend_stylesheets' => [
+ 'bundles/sonatapage/frontend.css',
+ ],
+ 'frontend_javascripts' => [],
],
'templates_admin' => [
'list' => '@SonataPage/PageAdmin/list.html.twig',
@@ -194,9 +197,12 @@ public function testPageWithoutMatrix(): void
'assets' => [
'stylesheets' => [
'bundles/sonatapage/app.css',
- 'bundles/sonatapage/frontend.css',
],
'javascripts' => [],
+ 'frontend_stylesheets' => [
+ 'bundles/sonatapage/frontend.css',
+ ],
+ 'frontend_javascripts' => [],
],
'templates_admin' => [
'list' => '@SonataPage/PageAdmin/list.html.twig',