dodo / node-slug

slugifies even utf-8 chars!
MIT License
1.07k stars 94 forks source link

Add support for missing unicode symbols resource #33

Closed wooorm closed 9 years ago

wooorm commented 9 years ago

By wrapping the require call in a try/catch statement, running slug will work with browserified CommonJS dependants.

So even when require is available, a missing unicode/category/So will not fail the process. Such a file is missing when, for example, browserify is run with --exclude.

Note: the test failed on this, but that seems to happen due to failures on the master branch.

wooorm commented 9 years ago

Hmm. I actually found that browserify’s similar --ignore works: browserify index.js --ignore unicode/category/So -s Something > something.js*, as ignore returns an object for an ignored require!

* where something.js just exposes window.slug = require('slug').