Go to file
Ian 6f02a26890
Merge pull request #624 from fmichenaud/fix_anchor_paper_gradient
Fixing anchor on Paper Gradient link
2021-05-24 15:32:10 +01:00
demos Fix spelling on pie 2016-05-20 09:10:45 +01:00
dist Regenerate dist 2017-02-07 13:25:01 +11:00
doc Fixing anchor on Paper Gradient link 2019-12-23 13:23:02 +01:00
src Fix for fill attribute getter 2017-02-06 12:05:34 +11:00
test Fix for fill attribute getter 2017-02-06 12:05:34 +11:00
.gitignore Fixed issue with parse in IE 2014-08-05 09:52:27 +10:00
.gitmodules Moving submodules (part 1) 2013-08-16 11:15:34 +10:00
.travis.yml Travis integration with Slack 2017-02-03 16:46:23 +11:00
CONTRIBUTING Pre 0.5.0 clean up 2017-02-03 22:19:22 +11:00
Gruntfile.js Pre 0.5.0 clean up 2017-02-03 22:19:22 +11:00
LICENSE Add License 2013-08-15 18:31:27 +10:00
NOTICE Fix for bug #25 & #110 2013-11-18 23:02:11 +11:00
README.md Update webpack install instructions (#551) 2017-10-02 23:07:52 +11:00
bower.json Fix for fill attribute getter 2017-02-06 12:05:34 +11:00
component.json Fix for fill attribute getter 2017-02-06 12:05:34 +11:00
dr.json Docs fix 2017-02-05 12:17:21 +11:00
history.md Fix for fill attribute getter 2017-02-06 12:05:34 +11:00
package.json Fix for fill attribute getter 2017-02-06 12:05:34 +11:00
template.dot Docs fix 2017-02-05 12:17:21 +11:00

README.md

Snap.svg · Build Status CDNJS GitHub Tag License

A JavaScript SVG library for the modern web. Learn more at snapsvg.io.

Follow us on Twitter.

Install

Learn

Use

In your HTML file, load simply by:

<script src="snap.svg-min.js"></script>

No other scripts are needed. Both the minified and uncompressed (for development) versions are in the /dist folder.

webpack

To load with webpack 2.x and 3.x, install Imports Loader (npm i -D imports-loader), and add the following to your webpack config:

module: {
  rules: [
    {
      test: require.resolve('snapsvg/dist/snap.svg.js'),
      use: 'imports-loader?this=>window,fix=>module.exports=0',
    },
  ],
},
resolve: {
  alias: {
    snapsvg: 'snapsvg/dist/snap.svg.js',
  },
},

Then, in any module youd like to require Snap, use:

import Snap from 'snapsvg';

Build

Build Status

Snap.svg uses Grunt to build.

  • Open the terminal from the Snap.svg directory:
cd Snap.svg
  • Install its command line interface (CLI) globally:
npm install -g grunt-cli

*You might need to use sudo npm, depending on your configuration.

  • Install dependencies with npm:
npm install

*Snap.svg uses Grunt 0.4.0. You might want to read more on their website if you havent upgraded since a lot has changed.

  • To build the files run
grunt
  • The results will be built into the dist folder.
  • Alternatively type grunt watch to have the build run automatically when you make changes to source files.

Testing

Tests are located in test folder. To run tests, simply open test.html in there. Automatic tests use PhantomJS to scrap this file, so you can use it as a reference.

Alternatively, install PhantomJS and run command

grunt test

Contribute

git checkout -b my_branch
  • Add your changes.
  • Check that tests are passing
  • Commit your changes:
git commit -am "Added some awesome stuff"
  • Push your branch:
git push origin my_branch

Note: Pull requests to other branches than dev or without filled CLA wouldnt be accepted.