Coder Social home page Coder Social logo

Comments (3)

jescalan avatar jescalan commented on June 13, 2024

Definitely, I should have been more clear with this - it does integrate the exact same way as nib if you're trying to figure it out immediately, but I have to run out for a bit, I'll definitely do a writeup and add this to the docs as soon as I get back 👍

from axis.

Jackbennett avatar Jackbennett commented on June 13, 2024

Ok so just blindly plugging

var roots = require('roots-css'); app.use(stylus.middleware({ src: __dirname + '/public', compile: compile } )); function compile(str, path){ return stylus(str) .set('filename', path) .use(roots()); }

Into a standard express -c stylus got base() working without complaints so there's that working.

I tried looking through the repos of roots and roots-css to get a clue how roots was adding this in but it's some magic i can't find. I see you can use a stylus plugin either @import in a .styl or adding it onto a command line stylus <file> --use <plugin> however that didn't help me out much trying to add to an existing project.

from axis.

jescalan avatar jescalan commented on June 13, 2024

Hey, so first of all, good work getting this to work right. The way you did it was 100% correct. I just finished adding a bit of documentation for the readme, so that will be pushed up in a minute - thats for pushing me to get this done.

To answer your question about the magic, this is where I bring it in as a part of roots:
https://github.com/jenius/roots/blob/master/lib/adapters/styl.js

...and this is how the interface exposes itself:
https://github.com/jenius/roots-css/blob/master/roots.js

You can see in the first file (as part of roots), I'm just requiring it exactly as you did above. For the second file, which is just roots.js at the root of this project, it adds a function that imports all of roots' mixins and such directly to the stylus rendering pipeline.

from axis.

Related Issues (20)

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.