Switch from grunt-css-url-embed to css-url-embed
This eliminates some rickety indirect dependencies and is a big step towards removing Grunt.
This commit is contained in:
24
Gruntfile.js
24
Gruntfile.js
@@ -12,6 +12,30 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
require('load-grunt-tasks')(grunt);
|
require('load-grunt-tasks')(grunt);
|
||||||
|
|
||||||
|
grunt.registerMultiTask('cssUrlEmbed', "Embed URLs as base64 strings inside your stylesheets", function () {
|
||||||
|
var done = this.async();
|
||||||
|
|
||||||
|
import('css-url-embed').then(cssEmbed => {
|
||||||
|
for (const file of this.files) {
|
||||||
|
try {
|
||||||
|
grunt.log.subhead('Processing source file "' + file.src[0] + '"');
|
||||||
|
const urls = cssEmbed.processFile(file.src[0], file.dest);
|
||||||
|
|
||||||
|
for (const url of urls) {
|
||||||
|
grunt.log.ok('"' + url + '" embedded');
|
||||||
|
}
|
||||||
|
|
||||||
|
grunt.log.writeln('File "' + file.dest + '" created');
|
||||||
|
} catch (e) {
|
||||||
|
grunt.log.error(e);
|
||||||
|
grunt.fail.warn('URL embedding failed\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
grunt.loadTasks('grunt/tasks');
|
grunt.loadTasks('grunt/tasks');
|
||||||
|
|
||||||
grunt.registerTask('default', ['sass:dist', "cssUrlEmbed"]);
|
grunt.registerTask('default', ['sass:dist', "cssUrlEmbed"]);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.3.1",
|
"@eslint/eslintrc": "^3.3.1",
|
||||||
"@eslint/js": "^9.24.0",
|
"@eslint/js": "^9.24.0",
|
||||||
|
"css-url-embed": "github:sgravrock/css-url-embed",
|
||||||
"eslint": "^9.24.0",
|
"eslint": "^9.24.0",
|
||||||
"eslint-plugin-compat": "^6.0.2",
|
"eslint-plugin-compat": "^6.0.2",
|
||||||
"glob": "^10.2.3",
|
"glob": "^10.2.3",
|
||||||
@@ -44,7 +45,6 @@
|
|||||||
"grunt-cli": "^1.3.2",
|
"grunt-cli": "^1.3.2",
|
||||||
"grunt-contrib-compress": "^2.0.0",
|
"grunt-contrib-compress": "^2.0.0",
|
||||||
"grunt-contrib-concat": "^2.0.0",
|
"grunt-contrib-concat": "^2.0.0",
|
||||||
"grunt-css-url-embed": "^1.11.1",
|
|
||||||
"grunt-sass": "^4.0.0",
|
"grunt-sass": "^4.0.0",
|
||||||
"jasmine": "^5.0.0",
|
"jasmine": "^5.0.0",
|
||||||
"jasmine-browser-runner": "github:jasmine/jasmine-browser-runner",
|
"jasmine-browser-runner": "github:jasmine/jasmine-browser-runner",
|
||||||
|
|||||||
Reference in New Issue
Block a user