duojs / file-deps Goto Github PK
View Code? Open in Web Editor NEWFind and replace all the dependencies in a JS or CSS file.
Find and replace all the dependencies in a JS or CSS file.
this always gets me...
index.css
@import './something'
something.css
.Something {
color: blue;
}
build.css
imo, omitting a ;
shouldn't break everything :/
I thought of this while working on the PR to prune dupes: #6
Currently these are considered different:
.a { background-image: url('z.png'); }
.b { background-image: url("./z.png"); }
It seems to me they should not be. Agreed?
Hey @matthewmueller, I tried to upgrade to [email protected]
in duo, but it breaks a lot of functionality. Namely, #7 has caused duo to not rewrite things like @import "./one.css";
since the ./
is being stripped.
The mapping going to duo-pack basically looks like:
{ 'index.css':
{ id: 'index.css',
type: 'css',
mtime: 1431373205000,
src: '@import "./one.css";\n\n.index {\n color: white;\n}\n',
deps: { 'one.css': 'one.css' },
entry: true },
'one.css':
{ id: 'one.css',
type: 'css',
mtime: 1417547024000,
src: '.one {\n color: green;\n}\n\n@import \'./two.css\';\n',
deps: { 'two.css': 'two.css' } },
'two.css':
{ id: 'two.css',
type: 'css',
mtime: 1417547024000,
src: '.two {\n color: red;\n}\n',
deps: {} } }
The deps
are now different, so duo-pack is not resolving them correctly.
Should this result in a change to duo-pack? Or is this a regression?
I was looking into fixing duojs/duo#438, and I ended up stopping at this lib once I noticed you are intentionally stripping the query/hash portion of the URL.
I'm curious why that's necessary? Is it just to prevent downloading the same file twice?
@matthewmueller This is currently impossible to catch:
.a { background-image: url('z.png'); }
.b { background-image: url("../fixtures/z.png"); }
The reason it is impossible to catch is that we don't have any information about the path
of the str
coming in here: https://github.com/MatthewMueller/file-deps/blob/master/lib/css.js#L33
What I would like to suggest/brain-storm is a minimal API change that would provide the path
of given str
so that we can rule out dupes more robustly.
It would be awesome if this lib would allow custom types to be registered from the outside, this would be a great first-step to solving duojs/duo#171
var filedeps = require("file-deps");
filedeps.type('html', function (str, ext, fn) {
// custom type handler
});
When using multiple backgrounds, this module does not parse url()
declarations after the first one properly:
a {
background-image: url('./logo.png'), url('./caret.png');
}
The first one (./logo.png
) gets parsed correctly, but the 2nd (./caret.png
) is not detected. (and is not rewritten by the consumer)
Should probably just return []
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.