The stringToSlug converts any string to SLUG (known as spinal-case or kebab-case). Or other (snake_case, PascalCase, ...) in any Languages. Having or not special characters (ã,é,í,ü,ñ...)
HTML JavaScript
Latest commit 0b9ce62 Mar 15, 2016 @leocaseiro Add Travis badge

README.md

jQuery plugin stringToSlug Bower version Build Status

A simple plugin in jQuery to create a URL. The stringToSlug converts string in any language, including those with accents and special characters, to a SLUG.

Documentation

Full documentation with examples at http://leocaseiro.github.io/jQuery-Plugin-stringToSlug/

Default Usage:

$(document).ready( function() {
    $("#string").stringToSlug();
});

Install via Bower:

bower install --save jquery.stringtoslug

Download:

Click here to download the latest version

Description

The stringToSlug uses a third-party library called speakingURL that removes special characters and converts the string to lowercase. The StringToSlug replaces spaces with space characters(separators) and offers the option to add a prefix and/or a suffix for your slug.

In order to transform a string into a url-friendly permalink, use the plugin to display a preview in a html element or in an input form.

Contributing

The StringToSlug uses NodeJS with NPM and Gulp to compile a code, and QUnit and Karma for testing:

To install Bower and Gulp globally, use npm install -g:

npm install bower -g
npm install gulp -g

Download and install all dependencies with NPM and make sure Bower is up to date:

npm install
bower install

List all tasks with Gulp

gulp

Watch all files with gulp watcher to develop and test in realtime

gulp watcher

Use gulp tests for testing

gulp tests

Use gulp build to compile

gulp build

License

Copyright (c) 2009-2016 Leo Caseiro. This is free software and is licensed under the MIT License.

Created and maintained by Leo Caseiro