Comments (6)
@thisconnect i release a new version with the fix
from postcss-copy.
Hi again,
-
Yes, this is correct,
postcss-copy
only reads the file 1 time. We use this to avoid read the file from the src multiple times but the transform is executed in each occurrence of the file. -
I understand what you are saying about the rare case but I think execute the transform in each occurrence it makes not sense because in the next step (writing the file) if the content doesn't change d we use the content cached so the transform processing was waste of time.
This a bug...the transform process has to be called only when the source is modified.
from postcss-copy.
Thanks! That works for me. I noticed that you pass query
, qparams
, qhash
in fileMeta
If you test
span {
background: url('images/bigimage.jpg?A#A');
}
div {
background: url('images/bigimage.jpg?B#B');
}
It would only report one (the first?) of them.
Chaning tranform on a filebase would not be 100% backwards compatible as some people may do different optimization depending on the querystrnig/hash.. altough that might be a rare case.
Not sure how this should be handled correctly. But it's no problem for me.
from postcss-copy.
Since transform is/should be on a per file base, I think query
, qparams
and qhash
does not make sense and should be removed from fileMeta. Changing to filebased transform is a breaking change and needs major semver upgrade IMO.
from postcss-copy.
Hi @thisconnect !
The fileMeta is an object with all kind of information of the file. I prefer keep the structure in all the copy process.
Chaning tranform on a filebase would not be 100% backwards compatible as some people may do different optimization depending on the querystrnig/hash.. altough that might be a rare case.
Yes at the begin I thought the same, but then i saw the code and i realized that in the old version even if the transform process had been called more than once per file the write process is called only one ( when the file doesn't exist or is modified).
So if some user in the past have tryed to use the transform process with different optimizations depending of the fileMeta it never going to work
So in my opinion it's not a breaking change, it's kind a bug and a feature that can be defined as a minor semver upgrade.
What do you think?
from postcss-copy.
Good to know, yes that makes sense. All good then and thanks again for your quick reply and fixed version!!
from postcss-copy.
Related Issues (20)
- Reduce changelog
- best ignore behaviour HOT 3
- Why ignore files throw an Error ? HOT 12
- Cannot read property 's' of undefined HOT 7
- Add to `fileMeta` path to css source HOT 6
- multiple src with similar folder structure HOT 9
- Allow usage query variable and hash in `template` option HOT 1
- regression relative url path HOT 12
- documentation imagemin example in readme is out of date HOT 4
- Hash function is called before transformation HOT 8
- Skip overwrite existing file? HOT 10
- glob src option HOT 3
- Allow `src` option to be optional and default to './' HOT 1
- Error: Cannot read property 'input' of undefined HOT 2
- Spaces in path replaced with %20 HOT 3
- Need a way to modify css asset path HOT 7
- Assets not copied when using node
- How to change the input path? HOT 1
- Feature Request: easy way to disable file renaming
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postcss-copy.