Version 2.14.1
April 16, 2025
- Access to the Sprig Playground is now blocked entirely when the config setting is disabled.
Version 2.14.0
April 9, 2025
- Updated htmx to version 2.0.4 (changelog).
- The Sprig Playground component template is now rendered in a sandboxed context.
- Fixed an information disclosure vulnerability.
- Fixed an XSS vulnerability.
Version 2.13.1
October 23, 2024
Changed
- Updated htmx to version 2.0.3 (changelog).
- The fetch function is now called inside an event listener when calling
sprig.triggerRefreshOnLoad()
, making it more robust. - Reverted some variable method name changes to improve autocompletion in PhpStorm.
Version 2.13.0
August 29, 2024
Added
- Added the ability to assign an ID to a component by passing a string as the third argument to the
sprig()
function.
Changed
- Updated htmx to version 2.0.2 (changelog).
Fixed
- Fixed the positioning of the JavaScript output by the
sprig.triggerRefreshOnLoad
function.
Deprecated
- Deprecated
sprig.getIsBoosted
,sprig.getIsError
,sprig.getIsHistoryRestoreRequest
,sprig.getIsInclude
,sprig.getIsRequest
,sprig.getIsSuccess
. Usesprig.isBoosted
,sprig.isError
,sprig.isHistoryRestoreRequest
,sprig.isInclude
,sprig.isRequest
,sprig.isSuccess
instead.
Version 2.12.0
August 20, 2024
Changed
- The
sprig.registerJs(js)
function now executes the registered JavaScript after htmx settles, and is now the recommended way of outputting JavaScript in Sprig components. - Components no longer render markup added via
{% html %}
,{% css %}
and{% js %}
tags during Sprig requests.
Version 2.11.0
August 8, 2024
Added
- Added the component configurations to a
Sprig
variable in the browser console whendevMode
is enabled. - Added the ability to pass any value into
s-method
, including theput
,patch
anddelete
verbs. - Added the
sprig.registerJs(js)
function.
Changed
- The
sprig.triggerRefresh(selector, variables)
function now prevents cyclical requests.
Version 2.10.1
August 6, 2024
Changed
- The
sprig.swapOob()
function now accepts a string in addition to a template to be rendered, in the second argument.
Version 2.10.0
August 1, 2024
Added
- Added the
sprig.swapOob(selector, template, variables)
function that swaps a template out-of-band. - Added the
sprig.triggerRefresh(selector, variables)
function that triggers a refresh on a Sprig component.
Changed
- Components now render markup added via
{% html %}
,{% css %}
and{% js %}
tags. - The
sprig.triggerRefreshOnLoad(selector)
function now appends output to the end of the body and should be called using{% do sprig.triggerRefreshOnLoad(selector) %}
.
Version 2.9.0
July 15, 2024
This update introduces htmx 2. Read about the changes →
Added
- Added the s-inherit attribute that allows you to control and enable automatic attribute inheritance for child nodes, if it has been disabled by default.
Changed
- Updated htmx to version 2.0.1 (2.0.0 release notes).
- The htmx file is now output even when Sprig components are used inside of
{% cache %}
tags (#329).
Removed
- Removed the
s-sse
ands-ws
attributes.
Version 2.8.1
April 21, 2024
Fixed
- Fixed a bug in which some
sprig
variables were incorrectly persisting across requests (#363).
Version 2.8.0
March 26, 2024
Added
- Added the
sprig.isSuccess
variable. - Added the
sprig.isError
variable. - Added the
sprig.message
variable. - Added the
sprig.modelId
variable.
Deprecated
- Deprecated the
success
variable. Usesprig.isSuccess
orsprig.isError
instead. - Deprecated the
flashes
variable. Usesprig.message
instead. - Deprecated the
id
variable. Usesprig.modelId
instead.
Version 2.7.2
September 29, 2023
Added
- Added the
sprig.registerScript()
function (#329).
Changed
- Renamed the
sprig.setAddScript()
function tosprig.setRegisterScript()
.
Version 2.7.1
September 27, 2023
Fixed
- Fixed a deprecated tag in the Sprig playground.
Version 2.7.0
September 26, 2023
The htmx script is now automatically injected into the end of the page whenever a Sprig component is created. If you have any JavaScript code in your layouts that rely on htmx being loaded, you will need to wrap them in
{% js %}
tags as per the docs.
Added
- Added the Sprig component generator that scaffolds PHP components via a console command (
php craft make sprig-component --path sprig/components
). - Added the s-cache attribute that allows you to specify if and for how long a request should be cached locally in the browser.
- Added the s-on:* attribute that allows you to respond to events directly on an element.
- Added the s-disabled-elt attribute that allows you to specify elements that will have the disabled attribute added to them for the duration of the request.
- Added the
sprig.htmxVersion
function. - Added the
sprig.setAddScript()
function. - Added friendly invalid variable exceptions that are shown when the Canary plugin is installed.
Changed
- The htmx script is now automatically injected into the end of the page whenever a Sprig component is created, meaning that the
sprig.script
function is no longer required and can be safely removed. - Updated htmx to version 1.9.6 (changelog).
- Simplified and improved invalid variable error messages.
- Invalid variable error messages are now only shown when
devMode
is turned on.
Fixed
- Fixed the response status code that is sent when required request parameters are not supplied (#325).
- Fixed a potential security issue.
Deprecated
- Deprecated the
sprig.script
function. It is no longer required and can be safely removed. - Deprecated the
s-on
attribute. Use thes-on:*
attribute instead.
Version 2.6.2
May 1, 2023
Changed
- Updated htmx to version 1.9.2 (changelog).
- Improved autocomplete documentation in the playground.
Version 2.6.1
April 25, 2023
Fixed
- Fixed a bug in which the htmx file was not being published even if it did not already exist locally (#305).
Version 2.6.0
April 23, 2023
Added
- Added the sprig.setConfig template variable that allows you to set configuration options for htmx (via a meta tag).
- Added the s-on attribute that allows you to respond to events directly on an element.
Changed
- Updated htmx to version 1.9.0 (release notes).
- The htmx file is now loaded locally rather than from a CDN, to reduce dependency on third-party sites (#303).
Version 2.5.1
January 31, 2023
Fixed
- Fixed rendered markup not being escaped in the Sprig playground.
Version 2.5.0
January 18, 2023
Added
- Added the s-history attribute that prevents sensitive data being saved to the history cache.
Changed
- Updated htmx to version 1.8.5 (release notes).
Version 2.4.0
December 8, 2022
Added
- Added the sprig.triggerRefreshOnLoad template variable that triggers a refresh event on all components on page load (#279).
Version 2.3.0
November 7, 2022
Added
- Added the s-validate attribute that forces an element to validate itself before it submits a request.
- Added the sprig.isHistoryRestoreRequest template variable that returns whether the request is for history restoration after a miss in the local history cache a client-side redirect without reloading the page.
Changed
Version 2.2.1
October 8, 2022
Fixed
- Fixed a bug in which Sprig requests were failing in live preview requests (#269).
Version 2.2.0
October 5, 2022
Added
- Added the s-replace-url attribute that allows you to replace the current url of the browser location history.
- Added the s-select-oob attribute that selects one or more elements from a server response to swap in via an out-of-band swap.
- Added the sprig.location(url) template variable that triggers a client-side redirect without reloading the page.
- Added the sprig.replaceUrl(url) template variable that replaces the current URL in the location bar.
- Added the sprig.reswap(value) template variable that allows you to change the swap behaviour.
Changed
- Updated htmx to version 1.8.0 (release notes).
Version 2.1.0
June 22, 2022
Added
- Added the Twigfield package that adds full autocomplete to the code editor in the playground (#235 ❤️@nystudio107).
Changed
- Improved attribute autocomplete in the playground.
Version 2.0.1
May 12, 2022
Changed
- Improved the styling of variables panes in the playground.
Version 2.0.0
May 4, 2022
Added
- Added compatibility with Craft 4.
Changed
- Restyled invalid variable error messages.
Removed
- Removed the deprecated
sprig.element
,sprig.elementName
,sprig.elementValue
andsprig.eventTarget
tags. - Removed the deprecated
s-vars
attribute.