Skip to content

Commit

Permalink
Use rollup and package.json to generate banner
Browse files Browse the repository at this point in the history
  • Loading branch information
domchristie committed Sep 1, 2016
1 parent 3b16f26 commit cb28f2c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
17 changes: 7 additions & 10 deletions dist/expanding.jquery.js
@@ -1,3 +1,10 @@
/*
* ExpandingTextareas 0.2.0
* Copyright © 2011+ Brian Grinstead
* Released under the MIT license
* http://bgrins.github.com/ExpandingTextareas/
*/

(function () {
'use strict';

Expand Down Expand Up @@ -175,13 +182,6 @@ TextareaClone.prototype = {
}
}

// Expanding Textareas v0.2.0
// MIT License
// https://github.com/bgrins/ExpandingTextareas

// Class Definition
// ================

function Expanding (textarea) {
var _this = this
this.element = createElement()
Expand All @@ -204,7 +204,6 @@ function Expanding (textarea) {
}

Expanding.prototype = {
// Updates the clone with the textarea value
update: function () {
this.textareaClone.value(this.textarea.value())
dispatch('expanding:update', { target: this.textarea.element })
Expand All @@ -214,8 +213,6 @@ Expanding.prototype = {
setStyles.call(this)
},

// Tears down the plugin: removes generated elements, applies styles
// that were prevously present, removes instance from data, unbinds events
destroy: function () {
this.element.removeChild(this.textareaClone.element)
this.element.parentNode.insertBefore(this.textarea.element, this.element)
Expand Down
17 changes: 7 additions & 10 deletions dist/expanding.js
@@ -1,3 +1,10 @@
/*
* ExpandingTextareas 0.2.0
* Copyright © 2011+ Brian Grinstead
* Released under the MIT license
* http://bgrins.github.com/ExpandingTextareas/
*/

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -174,13 +181,6 @@ TextareaClone.prototype = {
}
}

// Expanding Textareas v0.2.0
// MIT License
// https://github.com/bgrins/ExpandingTextareas

// Class Definition
// ================

function Expanding (textarea) {
var _this = this
this.element = createElement()
Expand All @@ -203,7 +203,6 @@ function Expanding (textarea) {
}

Expanding.prototype = {
// Updates the clone with the textarea value
update: function () {
this.textareaClone.value(this.textarea.value())
dispatch('expanding:update', { target: this.textarea.element })
Expand All @@ -213,8 +212,6 @@ Expanding.prototype = {
setStyles.call(this)
},

// Tears down the plugin: removes generated elements, applies styles
// that were prevously present, removes instance from data, unbinds events
destroy: function () {
this.element.removeChild(this.textareaClone.element)
this.element.parentNode.insertBefore(this.textarea.element, this.element)
Expand Down
10 changes: 3 additions & 7 deletions package.json
Expand Up @@ -8,25 +8,21 @@
"url": "git://github.com/bgrins/ExpandingTextareas.git"
},
"bugs": "https://github.com/bgrins/ExpandingTextareas/issues",
"licenses": [
{
"type": "MIT",
"url": "http://mit-license.org/"
}
],
"license": "MIT",
"author": {
"name": "Brian Grinstead",
"web": "http://briangrinstead.com/"
},
"main": "dist/expanding.js",
"scripts": {
"build": "rollup -c rollup.config.jquery.js",
"build": "rollup -c && rollup -c rollup.config.jquery.js",
"test": "standard src/*.js && node-qunit-phantomjs ./test/index.html"
},
"dependencies": {},
"devDependencies": {
"node-qunit-phantomjs": "^1.4.0",
"rollup": "^0.34.11",
"rollup-plugin-json": "^2.0.1",
"standard": "^8.0.0"
}
}
6 changes: 4 additions & 2 deletions rollup.config.jquery.js
@@ -1,5 +1,7 @@
export default {
import config from './rollup.config'

export default Object.assign({}, config, {
entry: 'src/expanding.jquery.js',
dest: 'dist/expanding.jquery.js',
format: 'iife'
};
})
17 changes: 15 additions & 2 deletions rollup.config.js
@@ -1,6 +1,19 @@
import json from 'rollup-plugin-json'
var pkg = require('./package.json')

export default {
entry: 'src/expanding.js',
dest: 'dist/expanding.js',
format: 'umd',
moduleName: 'Expanding'
};
moduleName: 'Expanding',
plugins: [json({ include: ['./package.json'] })],
banner: [
'/*',
' * ' + pkg.name + ' ' + pkg.version,
' * Copyright © 2011+ ' + pkg.author.name,
' * Released under the ' + pkg.license + ' license',
' * ' + pkg.homepage,
' */',
''
].join('\n')
}

0 comments on commit cb28f2c

Please sign in to comment.