monsieurbiz / sylius-scripts-plugin
Allows you to add JS scripts from the admin panel.
Installs: 7 447
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 3
Open Issues: 0
Type:sylius-plugin
pkg:composer/monsieurbiz/sylius-scripts-plugin
Requires
- php: ^8.2
- monsieurbiz/sylius-settings-plugin: ^2.0
- sylius/sylius: ~2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.16
- phpmd/phpmd: ^2.15
- phpspec/phpspec: ^7.0
- phpstan/phpstan: ^1.8.4
- phpstan/phpstan-doctrine: ^1.3.2
- phpstan/phpstan-webmozart-assert: ^1.1
- phpunit/phpunit: ^10.5
README
Scripts Settings for Sylius
This plugin lets you add JS scripts from the admin panel. You can add scripts to the header or the footer of your website.
For example, add Google Analytics, Facebook Pixel, or any other tracking script.
Compatibility
| Sylius Version | PHP Version |
|---|---|
| 2.0, 2.1 | 8.2 - 8.3 |
ℹ️ For Sylius 1.x, see our 1.x branch and all 1.x releases.
Installation
If you want to use our recipes, you can configure your composer.json by running:
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
composer require monsieurbiz/sylius-scripts-plugin
Create the config file in config/packages/monsieurbiz_sylius_scripts_plugin.yaml:
imports: resource: '@MonsieurBizSyliusScriptsPlugin/Resources/config/config.yaml'
Configuration
Go to the admin panel, then Settings > Scripts and add your scripts:
And that's it! Your scripts will be added:
How to
Change the default settings values for your project
Open the config/packages/monsieurbiz_sylius_scripts_plugin.yaml file and change the default values. For example:
monsieurbiz_sylius_settings: plugins: monsieurbiz_scripts.scripts: default_values: before_head_end: | <script type="text/javascript">console.log('My script');</script>


