This module provides the core functionality for the Sprig plugin, a reactive Twig component framework for Craft CMS. If you are developing a Craft plugin/module and would like to use Sprig in the control panel, then you can require this package to give you its functionality, without requiring that the site has the Sprig plugin installed.
First require the package in your plugin/module's composer.json
file.
{
"require": {
"putyourlightson/craft-sprig-core": "^2.0"
}
}
Then bootstrap the module from within your plugin/module's init
method.
use craft\base\Plugin;
use putyourlightson\sprig\Sprig;
class MyPlugin extends Plugin
{
public function init()
{
parent::init();
Sprig::bootstrap();
}
}
Then use the Sprig function and tags as normal in your control panel templates.
{{ sprig('_components/search') }}
If your plugin/module registers an asset bundle that depends on htmx being loaded, ensure that you specify the HtmxAssetBundle
class as a dependency.
use craft\web\AssetBundle;
use putyourlightson\sprig\assets\HtmxAssetBundle;
class MyAssetBundle extends AssetBundle
{
public $depends = [
HtmxAssetBundle::class,
];
}
Sprig plugin issues should be reported to https://github.com/putyourlightson/craft-sprig/issues
Sprig plugin changes are documented in https://github.com/putyourlightson/craft-sprig/blob/develop/CHANGELOG.md
Learn more and read the documentation at putyourlightson.com/plugins/sprig »
To see working examples and video tutorials, visit the learning resources.
This package is licensed for free under the MIT License.
This module requires Craft CMS 3.1.19 or later, or 4.0.0 or later, or 5.0.0 or later.
Install this package via composer.
composer require putyourlightson/craft-sprig-core
Created by PutYourLightsOn.