Browse Source

Update package.json and webpack

pull/561/head
Artur Arseniev 8 years ago
parent
commit
d50b6d999b
  1. 46621
      dist/grapes.js
  2. 4
      dist/grapes.min.js
  3. 1422
      index.html
  4. 2
      package-lock.json
  5. 8
      package.json
  6. 2
      src/dom_components/model/Component.js
  7. 10
      test/specs/dom_components/model/Component.js
  8. 48
      webpack.config.js

46621
dist/grapes.js

File diff suppressed because it is too large

4
dist/grapes.min.js

File diff suppressed because one or more lines are too long

1422
index.html

File diff suppressed because it is too large

2
package-lock.json

@ -1,6 +1,6 @@
{
"name": "grapesjs",
"version": "0.12.42",
"version": "0.12.43",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

8
package.json

@ -1,7 +1,7 @@
{
"name": "grapesjs",
"description": "Free and Open Source Web Builder Framework",
"version": "0.12.42",
"version": "0.12.43",
"author": "Artur Arseniev",
"license": "BSD-3-Clause",
"homepage": "http://grapesjs.com",
@ -74,8 +74,10 @@
},
"scripts": {
"lint": "eslint src",
"build": "npm run lint && npm run test && npm run v:patch && webpack --env.prod && npm run build:css",
"build-n": "npm run lint && npm run test && webpack --env.prod && npm run build:css",
"check": "npm run lint && npm run test",
"build": "npm run check && npm run v:patch && npm run build-dev && webpack --env=prod",
"build-n": "npm run check && npm run build:css && webpack --env=prod",
"build-dev": "webpack --env=dev && npm run build:css",
"build:css": "node-sass src/styles/scss/main.scss dist/css/grapes.min.css --output-style compressed",
"v:patch": "npm version --no-git-tag-version patch",
"start": "webpack-dev-server --open --progress --colors & npm run build:css -- -w",

2
src/dom_components/model/Component.js

@ -554,7 +554,7 @@ module.exports = Backbone.Model.extend(Styleable).extend({
for (let attr in attributes) {
const value = attributes[attr];
if (!isUndefined(value) && value !== '') {
if (!isUndefined(value)) {
attrs.push(`${attr}="${value}"`);
}
}

10
test/specs/dom_components/model/Component.js

@ -82,6 +82,16 @@ module.exports = {
expect(obj.toHTML()).toEqual('<article data-test1="value1" data-test2="value2"></article>');
});
it('Component toHTML with value-less attribute', () => {
obj = new Component({
tagName: 'div',
attributes: {
'data-is-a-test': ''
}
});
expect(obj.toHTML()).toEqual('<div data-is-a-test=""></div>');
});
it('Component toHTML with classes', () => {
obj = new Component({
tagName: 'article'

48
webpack.config.js

@ -4,19 +4,27 @@ const webpack = require('webpack');
const fs = require('fs');
let plugins = [];
module.exports = (env = {}) => {
if (env.prod) {
module.exports = env => {
const output = {
filename: './dist/grapes.min.js',
library: 'grapesjs',
libraryTarget: 'umd',
};
if (env == 'prod') {
plugins = [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.UglifyJsPlugin({ minimize:true, compressor: {warnings:false}}),
new webpack.BannerPlugin(`${pkg.name} - ${pkg.version}`),
]
];
} else if (env == 'dev') {
output.filename = './dist/grapes.js';
} else {
const index = 'index.html';
const indexDev = `_${index}`;
plugins.push(new HtmlWebpackPlugin({
template: fs.existsSync(indexDev) ? indexDev : index
}));
const template = fs.existsSync(indexDev) ? indexDev : index;
plugins.push(new HtmlWebpackPlugin({ template }));
}
plugins.push(new webpack.ProvidePlugin({
@ -26,24 +34,20 @@ module.exports = (env = {}) => {
return {
entry: './src',
output: {
filename: './dist/grapes.min.js',
library: 'grapesjs',
libraryTarget: 'umd',
},
output: output,
plugins: plugins,
module: {
loaders: [{
test: /grapesjs\/index\.js$/,
loader: 'string-replace-loader',
query: {
search: '<# VERSION #>',
replace: pkg.version
}
},{
test: /\.js$/,
loader: 'babel-loader',
include: /src/
test: /grapesjs\/index\.js$/,
loader: 'string-replace-loader',
query: {
search: '<# VERSION #>',
replace: pkg.version
}
},{
test: /\.js$/,
loader: 'babel-loader',
include: /src/
}],
},
resolve: {
@ -51,6 +55,6 @@ module.exports = (env = {}) => {
alias: {
jquery: 'cash-dom'
}
},
}
};
}

Loading…
Cancel
Save