Skip to main content

Lektor plugin to compile css out of sass - based on libsass

Project description

SCSS compiler for lektor

PyPI version Downloads Upload Python Package Linting Python package

SCSS compiler for Lektor that compiles css from sass.

How does it actually work?

  • It uses libsass
  • It looks for .scss and .sass files (ignores part files that begin with a underscore e.g. '_testfile.scss') and compiles them as part of the build process.
  • It only rebuilds the css when it's needed (file changed, a file it imports changed or the config changed).
  • When starting the the development server it watches the files for changes in the background and rebuilds them when needed.

Installation

You can install the plugin with Lektor's installer:

lektor plugins add lektor-scss

Or by hand, adding the plugin to the packages section in your lektorproject file:

[packages]
lektor-scss = 1.5.0

Usage

To enable the plugin, pass the scss flag when starting the development server or when running a build:

# build and compile css from scss
lektor build -f scss

# edit site with new generated css
lektor server -f scss

Python3

It is highly recommended to use this plugin with a python3 version of lektor.

Since lektor can be used as a python module it is possible to enforce this (after lektor is installed eg. with pip3 install --user --upgrade lektor) with the following command:

# run a python3 lektor server with new generated css
python3 -m lektor server -f scss

Configuration

The Plugin has the following settings you can adjust to your needs:

parameter default value description
source_dir assets/scss/ the directory in which the plugin searchs for sass files (subdirectories are included)
output_dir assets/css/ the directory the compiled css files get place at
output_style compressed coding style of the compiled result. choose one of: 'nested', 'expanded', 'compact', 'compressed'
source_comments False whether to add comments about source lines
precision 5 precision for numbers
include_paths If you want to include SASS libraries from a different directory, libsass's compile function has a parameter called include_paths to add those directories to the search path.
use_compile_flag True If True the flag '-scss' is needed. Otherwise not.

An example file with the default config can be found at configs/scss.ini. For every parameter that is not specified in the config file the default value is used by the plugin.

Development

To test and/or develop on this plugin in your running lektor installation, simply place it in the packages/ Folder and have a look at the Lektor Doku

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lektor-scss-1.5.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

lektor_scss-1.5.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file lektor-scss-1.5.0.tar.gz.

File metadata

  • Download URL: lektor-scss-1.5.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for lektor-scss-1.5.0.tar.gz
Algorithm Hash digest
SHA256 9bc6043d07d6b91a3daf40de18682b3e4889309ab15520e5672410caea92e4bb
MD5 a274f06701237052021bd2961969797e
BLAKE2b-256 ee4290bff8fdbd4dca5a8d10404bddafa417e5b1d3afc63d71e98d7c85fe68d0

See more details on using hashes here.

File details

Details for the file lektor_scss-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: lektor_scss-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for lektor_scss-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c9249c5de3ed89418fbc9e995da3a2e93e53dea6690ac4ddba286f14f6bc55
MD5 1d2da22d273d8b1cdee11185a53f7fd1
BLAKE2b-256 195732eaf71eac4a4d20f2a5820c8a5c108ab177a1262b42275bb133f34e5b97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page