borodean / assets Goto Github PK
View Code? Open in Web Editor NEWSimple asset resolver, a core of postcss-assets
License: MIT License
Simple asset resolver, a core of postcss-assets
License: MIT License
Is there a chance of publishing 2.1.1 to NPM as it contains an update pointing to v4 of lodash?
Env:
Errors:
Error: Cannot find module 'calipers-png'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at /Users/xxx/test/node_modules/calipers/lib/index.js:32:14
at Array.map (native)
at module.exports (/Users/xxx/test/node_modules/calipers/lib/index.js:28:22)
at Object.<anonymous> (/Users/xxx/test/node_modules/assets/lib/size.js:1:97)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
Reasons:
these code in the assets/lib/size.js
caused the problems
var calipers = require('calipers')('webp', 'png', 'jpeg', 'gif', 'svg');
In the calipers
module.exports = function () {
var args = Array.prototype.slice.call(arguments);
var plugins = args.map(function (arg) {
if (typeof arg === 'object') {
return arg;
} else {
return require('calipers-' + arg);
}
});
return {
measure: measure.bind(null, plugins)
};
};
But, the installed packages are the followwings:
$ ls node_modules/
assets calipers inflight once
async calipers-svg inherits path-is-absolute
balanced-match calipers-webp lodash wrappy
bluebird concat-map mime
brace-expansion glob minimatch
And
$ ls node_modules/assets/node_modules/
calipers-gif calipers-jpeg calipers-png
So. calipers
in node_modules/
couldn't find calipers-png
in node_modules/assets/node_modules/
.
The solutions:
var webp = require('calipers-webp');
var png = require('calipers-png');
var jpeg = require('calipers-jpeg');
var gif = require('calipers-gif');
var svg = require('calipers-svg');
var calipers = require('calipers')(webp, png, jpeg, gif, svg);
If the svg has style tag. un encoded svg will not shown in ie11.
The demo:
npm install @types/assets
npm ERR! code E404
npm ERR! 404 Not Found: @types/assets@latest
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2018-12-07T08_42_30_384Z-debug.log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.