Skip to content

A reactive Twig component framework for Craft CMS.

License

Notifications You must be signed in to change notification settings

putyourlightson/craft-sprig-core

Repository files navigation

Stable Version Total Downloads

Sprig Core Module for Craft CMS

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

Documentation

Learn more and read the documentation at putyourlightson.com/plugins/sprig »

To see working examples and video tutorials, visit the learning resources.

License

This package is licensed for free under the MIT License.

Requirements

This module requires Craft CMS 3.1.19 or later, or 4.0.0 or later, or 5.0.0 or later.

Installation

Install this package via composer.

composer require putyourlightson/craft-sprig-core

Created by PutYourLightsOn.

About

A reactive Twig component framework for Craft CMS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •