imarc / craft-sass
A Craft plugin that compiles SASS on the server as needed.
Installs: 3 700
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 26
Forks: 4
Open Issues: 5
Type:craft-plugin
Requires
- composer/installers: ~1.0
- leafo/scssphp: ^0.1.1
This package is auto-updated.
Last update: 2024-11-13 12:16:51 UTC
README
This is a Sass plugin for Craft using scssphp.
It compiles SASS to CSS on the fly, and caches the results to disk until the file changes.
Installation
Installation requires composer. This plugn also is makes use of composer/installers to make the plugin composer compatible.
- In the root of your project, run
composer require imarc/craft-sass
.This will create avendor/
directory as well as automatically put the plugin it self incraft/plugins/sass/
. - Upload both the
vendor/
andcraft/plugins/sass/
directories. - Enable the plugin in the Craft Plugins panel.
Usage
Upload SCSS files within your document root. For example, public/css/styles.scss
.
Linking to that file from a twig template should look something like this:
<link rel="stylesheet" type="text/css" href="{{ craft.sass.link('/css/styles.scss') }}" media="all" />
craft.sass.link()
generates a link that is routed to the plugin, which in turn compiles the SASS file into CSS.
Tests
To run the tests, be sure you have phpunit installed and then:
composer install
phpunit