Skip to content

Commit

Permalink
fix(GaspardElements): Exporting class
Browse files Browse the repository at this point in the history
Ability to import GaspardElements class from the main

BREAKING CHANGE: GaspardElement now can be used
  • Loading branch information
lucaperret committed Aug 8, 2017
1 parent 1871503 commit 5580ffe
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 16 deletions.
6 changes: 4 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
[
"env",
{
"loose": true,
"modules": false
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}
],
"stage-2"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const Gaspard = require('gaspard')
Via `<script>`
```html
<script src="node_modules/gaspard/dist/gaspard.umd.js"></script>
<!-- or using jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/gaspard"></script>
<script>
Gaspard.documentReady(function () {
Gaspard.find('html').addClass('dom-loaded');
Expand Down
5 changes: 3 additions & 2 deletions dist/gaspard.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/gaspard.umd.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions examples/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { find } from '../src'
console.log(find('#app2'))
// const elements = new GaspardElements('#app2')
// elements.css('background-color', 'red')
// console.log(elements)
import * as Gaspard from '../dist/gaspard.umd'
console.log(Gaspard)
const elements = new Gaspard.GaspardElements('#app2')
elements.css('background-color', 'red')
console.log(elements)
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gaspard",
"version": "1.0.1",
"version": "2.0.0",
"description": "Lightweight DOM helpers",
"homepage": "https://github.com/lucaperret/gaspard",
"main": "dist/gaspard.umd.js",
Expand Down Expand Up @@ -40,6 +40,7 @@
"babel-jest": "^20.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-2": "^6.24.1",
"commitizen": "^2.9.6",
Expand Down Expand Up @@ -68,7 +69,8 @@
},
"browserslist": [
"> 1%",
"last 2 versions"
"last 2 versions",
"not ie <= 8"
],
"config": {
"commitizen": {
Expand Down
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* @namespace index
*/

import GaspardElements from './gaspard'

export { find, is, contains, prev, next, siblings, parent } from './selectors'
export { hasClass, addClass, removeClass, toggleClass } from './attributes'
export { hasClass, addClass, removeClass, toggleClass, attr, css } from './attributes'
export { parseHTML, before, after, prepend, append, clone, remove, text, html, replaceWith } from './content'
export { fadeIn, hide, show } from './effects'
export { fadeIn, fadeOut, hide, show } from './effects'
export { viewportPosition, offset, position, outerHeight, outerWidth } from './positions'
export { off, on, trigger, documentReady } from './events'
export { GaspardElements } from './gaspard'
export { GaspardElements }
10 changes: 8 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const configDevevelopment = {
}
]
},
devtool: '#cheap-module-eval-source-map',
devtool: 'cheap-module-eval-source-map',
devServer: {
contentBase: [resolve('src'), resolve('dist'), resolve('examples')],
hot: true,
Expand Down Expand Up @@ -65,6 +65,7 @@ const configProduction = {
libraryTarget: 'umd',
umdNamedDefine: true
},
devtool: 'source-map',
module: {
rules: [
{
Expand All @@ -86,7 +87,12 @@ const configProduction = {
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.BannerPlugin(banner),
new webpack.optimize.UglifyJsPlugin()
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: true
}
})
]
}

Expand Down
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,12 @@ babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^
dependencies:
regenerator-transform "0.9.11"

babel-plugin-transform-runtime@^6.23.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee"
dependencies:
babel-runtime "^6.22.0"

babel-plugin-transform-strict-mode@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758"
Expand Down

0 comments on commit 5580ffe

Please sign in to comment.