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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
2081
package-lock.json
generated
2081
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
86
package.json
86
package.json
@@ -1,47 +1,45 @@
|
|||||||
{
|
{
|
||||||
"name": "color-thief",
|
"name": "color-thief",
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Lokesh Dhakar",
|
"name": "Lokesh Dhakar",
|
||||||
"email": "lokesh.dhakar@gmail.com",
|
"email": "lokesh.dhakar@gmail.com",
|
||||||
"url": "http://lokeshdhakar.com/"
|
"url": "http://lokeshdhakar.com/"
|
||||||
},
|
},
|
||||||
"description": "Get the dominant color or color palette from an image.",
|
"description": "Get the dominant color or color palette from an image.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"color",
|
"color",
|
||||||
"palette",
|
"palette",
|
||||||
"sampling",
|
"sampling",
|
||||||
"image",
|
"image",
|
||||||
"picture",
|
"picture",
|
||||||
"photo",
|
"photo",
|
||||||
"canvas"
|
"canvas"
|
||||||
],
|
],
|
||||||
"homepage": "http://lokeshdhakar.com/projects/color-thief/",
|
"homepage": "http://lokeshdhakar.com/projects/color-thief/",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/lokesh/color-thief.git"
|
"url": "https://github.com/lokesh/color-thief.git"
|
||||||
},
|
},
|
||||||
"licenses": [
|
"licenses": [
|
||||||
{
|
{
|
||||||
"type": "MIT",
|
"type": "MIT",
|
||||||
"url": "https://raw.githubusercontent.com/lokesh/color-thief/master/LICENSE/"
|
"url": "https://raw.githubusercontent.com/lokesh/color-thief/master/LICENSE/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "node ./build/build.js",
|
||||||
|
"dev": "http-server ./",
|
||||||
|
"test": "./node_modules/.bin/cypress open"
|
||||||
|
},
|
||||||
|
"main": "dist/color-thief.min.js",
|
||||||
|
"devDependencies": {
|
||||||
|
"@node-minify/core": "^4.0.5",
|
||||||
|
"@node-minify/uglify-es": "^4.0.5",
|
||||||
|
"cypress": "^3.2.0",
|
||||||
|
"http-server": "^0.11.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.15.3"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"scripts": {
|
|
||||||
"dev": "echo 'coming soon'",
|
|
||||||
"test": "./node_modules/.bin/cypress open"
|
|
||||||
},
|
|
||||||
"main": "dist/color-thief.min.js",
|
|
||||||
"devDependencies": {
|
|
||||||
"cypress": "^3.2.0",
|
|
||||||
"grunt": "~1.0.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": {
|
|
||||||
"node": ">=10.15.3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user