GithubHelp home page GithubHelp logo

walle89 / svg-stylus Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 9.0 20 KB

This project aims to recreate the functionality of rework-svg but adapted to work with Stylus.

JavaScript 87.87% CSS 5.98% HTML 6.15%

svg-stylus's People

Contributors

joekukish avatar lazd avatar pgoldrbx avatar walle89 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

svg-stylus's Issues

Relative URL Support?

Hello, I have a need to use relative URL's with svg-stylus.

For example, if I have an index.styl file that requires another file:

@require components/checkbox/styl/checkbox.styl'

And I want to reference a file relative to checkbox.styl:

background-image: svgurl('../embed/Checkbox.svg') svg(path fill $checkbox-check-color);

... this doesn't work. I dug in a bit and saw a base_path variable in svg.js, but when I debugged it it was null. Is there a way I can set that to the Stylus file that is being processed? I'm guessing not, as it seems to be compiled down to one file by that point.

Passing multiple svg params

First i have to thank you for the plugin. It is very useful!

But i have a question about passing more than one param (e.g. "fill") to the svg() function

My SVG Example (decoded base 64):
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve"> <g> <polyline fill="none" stroke="#999" stroke-width="2" stroke-linejoin="bevel" stroke-miterlimit="10" points="27,15 44,32 27,49 "/> </g> </svg>

My stylus code looks like:
background-image svgurl('./src/svg/arrows_right.svg') svg(polyline stroke $gray-dark-1 stroke-width $svg-stroke-width)
As you can see, i tried to adapt more than the stroke-color. But without success.
How can i achieve this with your plugin?

And what if i want to change the width and height params of the svg? Can this be passed also?

Best regards
Volker

Dependencies are too loose

Given that * dependencies could introduce breaking changes, it is recommended that the version is less relaxed.

Allow multiple embeds

Per HTML spec, the following should be possible

 background-image   : url(https://mdn.mozillademos.org/files/11305/firefox.png),
                       url(https://mdn.mozillademos.org/files/11307/bubbles.png);

Currently embedding multiple backgrounds with svgurl is not possible. Only the first one will be correctly embedded.

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.