0.0.5 • Published 4 years ago

@jrg/koa-sass v0.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

koa-dart-sass

Koa Sass Middleware using Dart Sass instead of Node-Sass

Example

The basic example is...

  1. Install dependencies

    npm install --save koa-mount koa koa-static @jrg/koa-sass

  2. Make the style directory

    mkdir styles

  3. Create a simple SCSS vi ./styles/test.scss and add the following...

    $base-color: red; h1{ background-color:$base-color; }

  4. Create the following class in a server.mjs

    import mount from 'koa-mount'; import Koa from 'koa'; import serve from 'koa-static'; import {KoaSass} from '@jrg/koa-sass';

    const app = new Koa(); const main = new Main(); const stylesApp = new Koa(); const sass = new KoaSass();

    stylesApp.use(sass.koaMiddleware); stylesApp.use(serve('styles'));

    app.use(mount('/styles', stylesApp)) app.listen(3000);

  5. Run the application using node --experimental-modules server.mjs

  6. Visit http://locahost:3000/styles/test.scss. It should be rendered like a normal css file and can be used like...

    link(rel="stylesheet" type="text/css" href="/styles/test.scss")

Issues

  1. Still working on an implementation to allow sass files
  2. Add ability to fallback to node-sass
  3. Add additional configuration params
0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago