Created
February 7, 2016 07:01
-
-
Save rnjailamba/d49888d68bed5c5b172c to your computer and use it in GitHub Desktop.
Sir Trevor JS + Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.Install Bower | |
npm install -g bower | |
2.Add a bower.json file parallel to app.js/server.js file with following contents - | |
{ | |
"name": "your-project", | |
"dependencies": { | |
"sir-trevor-js": "0.4.3" | |
}, | |
"resolutions": { | |
"jquery": "~1.9.1" | |
} | |
} | |
3.Do bower install in root directory of your project. | |
4.A new folder is created by bower in root directory. | |
5.Write this in app.js | |
app.use('/bower', modules.express.static(__dirname + '/bower_components/')); | |
6.Add following lines in any view | |
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<script src="/bower/sir-trevor-js/sir-trevor.js"></script> <!-- js for sir trevor /--> | |
<link rel="stylesheet" type="text/css" href="/bower/sir-trevor-js/sir-trevor.css"></link><!-- css for sir trevor --> | |
<link rel="stylesheet" type="text/css" href="/bower/sir-trevor-js/sir-trevor-icons.css"></link><!-- css for sir trevor icons --> | |
<form> | |
<textarea class="js-st-instance"></textarea> | |
<button type="submit">Submit button</button> | |
</form> | |
<script> | |
$(document).ready(function () { | |
<!--alert("here");--> | |
new SirTrevor.Editor( { | |
el: $('.js-st-instance'), | |
defaultType: "Text", | |
} | |
); | |
} | |
); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment