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.
Full documentation with examples at http://leocaseiro.github.io/jQuery-Plugin-stringToSlug/
$(document).ready( function() {
$("#string").stringToSlug();
});
bower install --save jquery.stringtoslug
Click here to download the latest version
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.
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
Copyright (c) 2009-2018 Leo Caseiro. This is free software and is licensed under the MIT License.
Created and maintained by Leo Caseiro