mattdesl / three-line-2d

lines expanded in a vertex shader
MIT License
236 stars 34 forks source link

Please provide some sort of build or getting started instructions #5

Closed ridiculousfish closed 8 years ago

ridiculousfish commented 8 years ago

This is surely obvious to users steeped in the npm ecosystem, but I am totally new to npm and quickly got lost trying to do anything with this package.

  1. Click on the test.js link from the README.md hoping for a complete example.

Result: broken link.

  1. Try npm install mattdesl/three-line-2d. This looks promising: I get some files.
  2. Try open node_modules/three-line-2d/index.html

My browser outputs an error about missing bundle.js

  1. Try cd node_modules/three-line-2d/ ; npm run-script build:

Error: Cannot find module '/Users/peter/days/16_05_14/node_modules/three-line-2d/test/index.js' from '/Users/peter/days/16_05_14/node_modules/three-line-2d'

I don't know how to proceed from here.

If the answer is that I need to go read up on npm for a while, tell me and I'll buzz off. But I'd appreciate if this repo included the basic steps to get started!

ridiculousfish commented 8 years ago

(Also, in case there was any doubt, this looks really cool and I am desperate to try it!)

mattdesl commented 8 years ago

This module is intended to be consumed with npm and a bundler like Browserify. It may also work with Webpack, Rollup, etc – although I haven't tested those.

To run the demo for this project locally, you have to clone and install dependencies.

If you want to use it yourself from your project, you have a couple options. If you don't want to use npm/browserify/etc – you can download this module from a service like BrowserifyCDN or Wzrd.in. Here is a UMD build of the latest version, minified, which you can add into a <script> tag: https://wzrd.in/standalone/three-line-2d@%5E1.1.3

The recommended approach for all these modules is a bit more cumbersome, but IMHO generally worth it once you get over the initial learning curve. It involves npm, browserify, and a local development server like budo. The same concepts should transfer easily to Webpack, Rollup, etc. Further reading:

The workflow is pretty much the same for all my modules (and lots of others – like stackgl), but the READMEs don't always include this sort of information.

Hope that clears things up! :tada:

P.S. Thanks for the heads up – I fixed some things in the readme.

ridiculousfish commented 8 years ago

Awesome! The readme update is a huge help and I got it running. Thank you so much!!