mirror of
https://github.com/janishutz/color-thief.git
synced 2025-11-25 13:54:25 +00:00
Replace Grunt w/node deps: http-server, node-minify, uglify
This commit is contained in:
50
Gruntfile.js
50
Gruntfile.js
@@ -1,50 +0,0 @@
|
|||||||
module.exports = function(grunt) {
|
|
||||||
|
|
||||||
grunt.initConfig({
|
|
||||||
connect: {
|
|
||||||
server: {
|
|
||||||
options: {
|
|
||||||
port: 8000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
jshint: {
|
|
||||||
files: ['src/color-thief.js']
|
|
||||||
},
|
|
||||||
jscs: {
|
|
||||||
src: [
|
|
||||||
'src/color-thief.js'
|
|
||||||
],
|
|
||||||
options: {
|
|
||||||
config: ".jscsrc"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
uglify: {
|
|
||||||
options: {
|
|
||||||
preserveComments: 'some',
|
|
||||||
sourceMap: false
|
|
||||||
},
|
|
||||||
dist: {
|
|
||||||
files: {
|
|
||||||
'dist/color-thief.min.js': ['src/color-thief.js']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
test: {
|
|
||||||
files: ['src/color-thief.js'],
|
|
||||||
tasks: ['jshint', 'jscs']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
||||||
grunt.loadNpmTasks('grunt-jscs');
|
|
||||||
|
|
||||||
grunt.registerTask('default', ['connect', 'watch']);
|
|
||||||
grunt.registerTask('test', ['jshint', 'jscs']);
|
|
||||||
grunt.registerTask('build', ['uglify']);
|
|
||||||
};
|
|
||||||
10
README.md
10
README.md
@@ -31,13 +31,3 @@ colorThief.getPalette(sourceImage, 8);
|
|||||||
getPalette(sourceImage[, colorCount, quality])
|
getPalette(sourceImage[, colorCount, quality])
|
||||||
returns [ [num, num, num], [num, num, num], ... ]
|
returns [ [num, num, num], [num, num, num], ... ]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run test // Run Cypress acceptance tests
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|||||||
20
build/build.js
Normal file
20
build/build.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
const minify = require('@node-minify/core');
|
||||||
|
const uglify = require('@node-minify/uglify-es');
|
||||||
|
|
||||||
|
minify({
|
||||||
|
compressor: uglify,
|
||||||
|
input: './src/color-thief.js',
|
||||||
|
output: './dist/color-thief.min.js',
|
||||||
|
options: {
|
||||||
|
output: {
|
||||||
|
comments: 'some'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: function(err, min) {
|
||||||
|
if (err) {
|
||||||
|
console.log('⚠️ERROR:' + err);
|
||||||
|
} else {
|
||||||
|
console.log('✅ Minification completed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
2079
package-lock.json
generated
2079
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -28,18 +28,16 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "echo 'coming soon'",
|
"build": "node ./build/build.js",
|
||||||
|
"dev": "http-server ./",
|
||||||
"test": "./node_modules/.bin/cypress open"
|
"test": "./node_modules/.bin/cypress open"
|
||||||
},
|
},
|
||||||
"main": "dist/color-thief.min.js",
|
"main": "dist/color-thief.min.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@node-minify/core": "^4.0.5",
|
||||||
|
"@node-minify/uglify-es": "^4.0.5",
|
||||||
"cypress": "^3.2.0",
|
"cypress": "^3.2.0",
|
||||||
"grunt": "~1.0.1",
|
"http-server": "^0.11.1"
|
||||||
"grunt-contrib-connect": "^1.0.2",
|
|
||||||
"grunt-contrib-jshint": "^0.11.2",
|
|
||||||
"grunt-contrib-uglify": "~2.0.0",
|
|
||||||
"grunt-contrib-watch": "^1.0.0",
|
|
||||||
"grunt-jscs": "^1.8.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.15.3"
|
"node": ">=10.15.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user