Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link to postcss-assets-rebase #442

Merged
merged 1 commit into from Jul 23, 2015
Merged

Add link to postcss-assets-rebase #442

merged 1 commit into from Jul 23, 2015

Conversation

cakeinpanic
Copy link
Contributor

No description provided.

ai added a commit that referenced this pull request Jul 23, 2015
Add link to postcss-assets-rebase
@ai ai merged commit b0cfdce into postcss:master Jul 23, 2015
@ben-eb
Copy link
Member

ben-eb commented Jul 23, 2015

There's no link to the plugin?

@ai
Copy link
Member

ai commented Jul 23, 2015

@ben-eb and order is wrong :). I wil fix it.

@MoOx
Copy link
Contributor

MoOx commented Jul 23, 2015

Also, it's seems to be a duplicate. postcss-url already does that (and many more).

@ai
Copy link
Member

ai commented Jul 23, 2015

@MoOx I am OK with high specific tools for one purpose. Sometimes it is difficult to understand how to use postcss-url in this way. And anyway you will have a some unshared code in postcss-url callbacks.

@MoOx
Copy link
Contributor

MoOx commented Jul 23, 2015

postcss-url is a complete solution to handle assets. It can inline and fallback to rebase + copy for example.

@ai
Copy link
Member

ai commented Jul 23, 2015

@MoOx but postcss-url can’t do postcss-assets-rebase behaviour without the line of code? I mean, that anyway user will be forced to write few lines for callback. And of course he/she want to share this code. This is why some specific solution is OK.

@MoOx
Copy link
Contributor

MoOx commented Jul 23, 2015

No need for a callback. Where did you see that? Callback is just another way to handle custom adjustment. https://github.com/postcss/postcss-url#usage

@ai
Copy link
Member

ai commented Jul 23, 2015

@MoOx hm, my mistake. So postcss-assets-rebase can be full reproduced by postcss-url just with configs?

@cakeinpanic what do you think?

@cakeinpanic
Copy link
Contributor Author

@MoOx I've tried yo use postcss-url for our project, and also have done PR.
At that moment the only solution to rebase assets correctly was using callback. Its size was about 90% of postcss-url's size. I thought your copy method worked correctly for some cases(but not for mine), so I decided to write my own plugin for my purposes.
As I can see, copy method was refactored, maybe it works properly now, but i've already developed my own at that point.

By now, there are two options different from postcss-url: for assetsPath relative to .css and for assets renaming. And postcss-assets-rebase allows to and from options to be equal

@cakeinpanic
Copy link
Contributor Author

@MoOx if you want, we can try to merge our plugins, no problem.

@MoOx
Copy link
Contributor

MoOx commented Jul 23, 2015

Fact: I only use url: rebase method (for imports), since my assets are handled by webpack.
That said, this plugin is bundled in cssnext, so I think some others people can be interested by this feature. Did you check this PR? postcss/postcss-url#38
I think it's better to have one plugin to handle the same kind of stuff (in this case, rebase+copy), but if you plugin handle different uses cases (from what I see, not really), I don't have any problem with 2 plugins.
I just think one is better to handle similar things.

@ai
Copy link
Member

ai commented Jul 23, 2015

Yeap, I am thinking right not to remove this plugin.

@tinchoz49
Copy link

hi @cakeinpanic as you said I did a rewrite of the copy method, here you can see the repo where i'm testing it: https://github.com/tinchoz49/test-postcss-copy

@cakeinpanic
Copy link
Contributor Author

I've checked your test repo, thank you, @tinchoz49
Ok, so by now there are some differences between our plugins.
In postcss-assets-rebase

  • duplicated assets renaming
  • assets folder structure saving. in postcss-url asset is copied with its folder structure. so if it has ten folders from .css, all ten folders would be created
  • works ok when from === to (honestly, for our project it's the most common case)

In postcss-url

  • hash
  • base64
  • custom transform function
  • basePath

For now I can say that our plugin fits better for postprocessing files generated by stylus(or LESS, or another preprocessor)

@ai what do you think, is it still count as duplicate?

@ai
Copy link
Member

ai commented Sep 3, 2015

Yeap, the problem with dublicate is not that it is equal, but in splitting forces. It is always better to put forces to one project, than support two.

But I am not against adding it to list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants