forked from ritz078/embed-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ritz078#212 from ritz078/upgrade-build
Upgrade build
- Loading branch information
Showing
25 changed files
with
599 additions
and
619 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,9 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"es6": true, | ||
"browser": true | ||
}, | ||
"parser": "babel-eslint", | ||
"extends": "eslint:recommended", | ||
"extends": "standard", | ||
"rules": { | ||
"no-multi-spaces": 0, | ||
"key-spacing": 0, | ||
"no-return-assign": 0, | ||
"consistent-return": 0, | ||
"no-shadow": 0, | ||
"comma-dangle": 0, | ||
"no-use-before-define": 0, | ||
"no-empty": 0, | ||
"new-parens": 0, | ||
"no-cond-assign": 0, | ||
"no-fallthrough": 0, | ||
"new-cap": 0, | ||
"no-loop-func": 0, | ||
"no-unreachable": 0, | ||
"no-labels": 0, | ||
"no-process-exit": 0, | ||
"camelcase": 0, | ||
"no-console": 0 | ||
"one-var": "off", | ||
"no-tabs": "off", | ||
"no-useless-escape": "off", | ||
"no-new-func": "off" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,27 +24,27 @@ module.exports = function (grunt) { | |
options: { | ||
livereload: true | ||
}, | ||
css : { | ||
css: { | ||
files: ['src/css/**/*.scss'], | ||
tasks: ['sass', 'postcss'] | ||
}, | ||
js : { | ||
js: { | ||
files: ['src/js/**/*.js', 'build.json'], | ||
tasks: ['eslint', 'shell:rollup', 'uglify'] | ||
} | ||
}, | ||
|
||
postcss: { | ||
options: { | ||
map : false, | ||
map: false, | ||
processors: [ | ||
require('cssnano')({ | ||
convertValues: false | ||
}) | ||
] | ||
}, | ||
dist : { | ||
src : 'dist/embed.css', | ||
dist: { | ||
src: 'dist/embed.css', | ||
dest: 'dist/embed.min.css' | ||
} | ||
}, | ||
|
@@ -53,13 +53,13 @@ module.exports = function (grunt) { | |
|
||
'sprite': { | ||
all: { | ||
src : './assets/images/ejs_emojis/*.png', | ||
dest : './assets/images/emojis.png', | ||
retinaSrcFilter : './assets/images/ejs_emojis/*@2x.png', | ||
destCss : 'src/css/_emojis.scss', | ||
retinaDest : './assets/images/[email protected]', | ||
cssFormat : 'css', | ||
cssTemplate : 'sprite.handlebars', | ||
src: './assets/images/ejs_emojis/*.png', | ||
dest: './assets/images/emojis.png', | ||
retinaSrcFilter: './assets/images/ejs_emojis/*@2x.png', | ||
destCss: 'src/css/_emojis.scss', | ||
retinaDest: './assets/images/[email protected]', | ||
cssFormat: 'css', | ||
cssTemplate: 'sprite.handlebars', | ||
cssHandlebarsHelpers: { | ||
escape: function (name) { | ||
var x = ['+', '-', '/', '*']; | ||
|
@@ -81,11 +81,11 @@ module.exports = function (grunt) { | |
} | ||
} | ||
}, | ||
files : { | ||
files: { | ||
expand: true, | ||
cwd : 'assets/images/emojis', | ||
src : ['*.png'], | ||
dest : 'assets/images/ejs_emojis/' | ||
cwd: 'assets/images/emojis', | ||
src: ['*.png'], | ||
dest: 'assets/images/ejs_emojis/' | ||
} | ||
}, | ||
|
||
|
@@ -94,69 +94,65 @@ module.exports = function (grunt) { | |
options: { | ||
style: 'expanded' | ||
}, | ||
files : { | ||
files: { | ||
'dist/embed.css': 'src/css/embed.scss' | ||
} | ||
} | ||
}, | ||
|
||
'uglify': { | ||
options: { | ||
banner : "<%= meta.banner %>", | ||
mangle : true, | ||
banner: "<%= meta.banner %>", | ||
mangle: true, | ||
compress: { | ||
sequences : true, | ||
dead_code : true, | ||
sequences: true, | ||
dead_code: true, | ||
conditionals: true, | ||
booleans : true, | ||
unused : true, | ||
if_return : true, | ||
join_vars : true, | ||
booleans: true, | ||
unused: true, | ||
if_return: true, | ||
join_vars: true, | ||
drop_console: true | ||
} | ||
}, | ||
build : { | ||
build: { | ||
files: { | ||
'dist/embed.min.js': 'dist/embed.js' | ||
} | ||
} | ||
}, | ||
connect : { | ||
connect: { | ||
server: { | ||
options: { | ||
port : 8000, | ||
port: 8000, | ||
livereload: true, | ||
open : true, | ||
keepAlive : true, | ||
base : { | ||
path : './', | ||
open: true, | ||
keepAlive: true, | ||
base: { | ||
path: './', | ||
options: { | ||
index : 'demo/index.html', | ||
index: 'demo/index.html', | ||
maxAge: 300000 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
|
||
eslint: { | ||
target: ['src/js/**/*.js'] | ||
}, | ||
|
||
'string-replace': { | ||
dist: { | ||
files : { | ||
files: { | ||
'.tmp/embed.css': 'dist/embed.css' | ||
}, | ||
options: { | ||
replacements: [{ | ||
pattern : /..\/assets\/images\/loader.svg/g, | ||
pattern: /..\/assets\/images\/loader.svg/g, | ||
replacement: 'assets/images' | ||
}, { | ||
pattern : /..\/.\/assets\/images\/emojis/g, | ||
pattern: /..\/.\/assets\/images\/emojis/g, | ||
replacement: 'assets/images/emojis' | ||
}, { | ||
pattern : /..\/assets\/fonts/g, | ||
pattern: /..\/assets\/fonts/g, | ||
replacement: 'assets/fonts' | ||
}] | ||
} | ||
|
@@ -167,22 +163,22 @@ module.exports = function (grunt) { | |
dist: { | ||
files: [{ | ||
expand: true, | ||
src : 'assets/fonts/*', | ||
dest : 'dist/' | ||
src: 'assets/fonts/*', | ||
dest: 'dist/' | ||
}, { | ||
expand: true, | ||
src : 'assets/images/*', | ||
dest : 'dist/', | ||
src: 'assets/images/*', | ||
dest: 'dist/', | ||
filter: 'isFile' | ||
}] | ||
} | ||
}, | ||
|
||
bump: { | ||
options: { | ||
files : ['package.json'], | ||
commitFiles : ['-a'], | ||
pushTo : 'origin', | ||
files: ['package.json'], | ||
commitFiles: ['-a'], | ||
pushTo: 'origin', | ||
updateConfigs: ['pkg'] | ||
} | ||
}, | ||
|
@@ -204,18 +200,18 @@ module.exports = function (grunt) { | |
publish: { | ||
command: 'npm publish' | ||
}, | ||
rollup : { | ||
rollup: { | ||
command: 'rollup -c rollup.umd.config.js && rollup -c rollup.es2015.config.js' | ||
} | ||
} | ||
}); | ||
|
||
require('load-grunt-tasks')(grunt); | ||
|
||
grunt.registerTask("default", ["eslint", "shell:rollup", "sass", "connect", "watch"]); | ||
grunt.registerTask("build", ["clean", "build-emoji", "eslint", "shell:rollup", "sass", "uglify", "string-replace", "postcss", "copy"]); | ||
grunt.registerTask("default", ["shell:rollup", "sass", "connect", "watch"]); | ||
grunt.registerTask("build", ["clean", "build-emoji", "shell:rollup", "sass", "uglify", "string-replace", "postcss", "copy"]); | ||
grunt.registerTask("build-emoji", ["retinafy", "sprite", "sass"]); | ||
grunt.registerTask("dist", ["clean", "eslint", "shell:rollup", "sass", "uglify", "string-replace", "postcss", "copy"]); | ||
grunt.registerTask("dist", ["clean", "shell:rollup", "sass", "uglify", "string-replace", "postcss", "copy"]); | ||
|
||
grunt.registerTask("release", function (option) { | ||
grunt.task.run(["bump-only:" + option, "dist", "conventionalChangelog", "bump-commit", "shell:publish"]); | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
var commonjs = require('rollup-plugin-commonjs'); | ||
var npm = require('rollup-plugin-npm'); | ||
var pkg = require('./package.json'); | ||
var nodeResolve = require('rollup-plugin-node-resolve'); | ||
var pkg = require('./package.json'); | ||
var filesize = require('rollup-plugin-filesize'); | ||
|
||
var banner = "/*\n" + | ||
" * " + pkg.name + " - v"+ pkg.version +"\n" + | ||
" * " + pkg.description +"\n" + | ||
" * " + pkg.homepage +"\n" + | ||
" *\n" + | ||
" * Made by "+ pkg.author.name +"\n" + | ||
" * Under "+ pkg.license +" License\n" + | ||
" */\n"; | ||
" * " + pkg.name + " - v" + pkg.version + "\n" + | ||
" * " + pkg.description + "\n" + | ||
" * " + pkg.homepage + "\n" + | ||
" *\n" + | ||
" * Made by " + pkg.author.name + "\n" + | ||
" * Under " + pkg.license + " License\n" + | ||
" */\n"; | ||
|
||
|
||
var config = { | ||
entry : 'src/js/main.js', | ||
dest : 'dist/embed.es2015.js', | ||
format : 'es', | ||
banner : banner, | ||
sourceMap : true, | ||
plugins: [ | ||
npm({ | ||
jsnext : true, | ||
main : true | ||
}), | ||
commonjs({ | ||
include: 'node_modules/**' | ||
}) | ||
] | ||
entry: 'src/js/main.js', | ||
dest: 'dist/embed.es2015.js', | ||
format: 'es', | ||
banner: banner, | ||
sourceMap: true, | ||
plugins: [ | ||
nodeResolve({ | ||
jsnext: true, | ||
main: true | ||
}), | ||
commonjs({ | ||
include: 'node_modules/**' | ||
}), | ||
filesize() | ||
] | ||
}; | ||
|
||
module.exports = config; |
Oops, something went wrong.