Giter Club home page Giter Club logo

lektor-scss's Introduction

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

lektor-scss's People

Contributors

dependabot[bot] avatar do1jlr avatar maxbachmann avatar uwekamper avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

uwekamper

lektor-scss's Issues

the local server doesn't seem to refresh the css

Hi,
I just started using it but the server seems to refresh *.scss only and not the *.min.css. Here's an output during my scss editing:

U scss/style.scss
Finished build in 0.48 sec
Started prune
Finished prune in 0.09 sec
Started build
U scss/style.scss
Finished build in 0.48 sec
Started prune
Finished prune in 0.09 sec
Started build
U scss/style.scss
Finished build in 0.52 sec
Started prune
Finished prune in 0.11 sec
Started build
U scss/style.scss
Finished build in 0.51 sec
Started prune
Finished prune in 0.11 sec

While when I stop and restart the server the css is rebuilt. So I have to quit and start the server to see any change:

Started source info update
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
Finished source info update in 0.58 sec
Started build
css assets/scss/style.scss ➡ assets/css/style.min.css
U css/style.min.css
Finished build in 1.52 sec
Started prune
Finished prune in 0.12 sec

Thank you

[win 10 -- Python 3.11.2 -- Lektor, version 3.4.0b5 -- lektor-scss = 1.4.1]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.