Skip to content

Instantly share code, notes, and snippets.

@stravid
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stravid/a3a56d8eadc6251c0be9 to your computer and use it in GitHub Desktop.
Save stravid/a3a56d8eadc6251c0be9 to your computer and use it in GitHub Desktop.
Creating a Datepicker Ember Addon
// blueprints/ember-pikaday/index.js
module.exports = {
normalizeEntityName: function() {},
afterInstall: function() {
var that = this;
return this.addBowerPackageToProject('pikaday').then(function() {
return that.addBowerPackageToProject('momentjs');
});
}
};
// Rest of the file
app.import('bower_components/momentjs/moment.js');
app.import('bower_components/pikaday/pikaday.js');
app.import('bower_components/pikaday/css/pikaday.css');
module.exports = app.toTree();
// app/components/pikaday-input.js
import Ember from 'ember';
import PikadayInputComponent from 'ember-pikaday/components/pikaday-input';
export default PikadayInputComponent;
ember addon ember-pikaday
cd ember-pikaday
bower install --save-dev pikaday
bower install --save-dev momentjs
module.exports = {
name: 'ember-pikaday',
included: function(app) {
this._super.included(app);
app.import('bower_components/momentjs/moment.js');
app.import('bower_components/pikaday/pikaday.js');
app.import('bower_components/pikaday/css/pikaday.css');
}
};
npm version 0.0.1
git push origin master
git push origin --tags
npm publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment