postcss-assets icon indicating copy to clipboard operation
postcss-assets copied to clipboard

Add dependency message

Open ai opened this issue 9 years ago • 6 comments

New postcss-loader will support dependency message to notify webpack about imports. So we need to add few lines on every import:

result.messages.push({
  type: 'dependecy',
  parent: currentFilePath,
  file: absoluteFilePath
})

@borodean it is not really necessary for images plugins. But I think it will be good to have it here too.

ai avatar Oct 08 '16 08:10 ai

@borodean do you need any help?

ai avatar Nov 05 '16 11:11 ai

@ai sorry for being so slow at support. I guess I need some advice on how to organize the whole support/release process better.

Regarding the issue itself: I'll check it out again this weekend and let everyone know if there is anything standing between the current state and releasing this.

borodean avatar Nov 05 '16 17:11 borodean

Sure, what is your main problem with support/release process?

ai avatar Nov 05 '16 17:11 ai

@ai thanks, I'll create a separate issue on the process improvement.

Regarding this particular feature I've started a branch: https://github.com/assetsjs/postcss-assets/compare/feature/58-dependency-messages. Unfortunately, it doesn't work and I'm being blocked by several thingies:

  1. The problem is that the assets core library provides no way to retrieve the original file path of the resolved asset. I'd be grad if anyone helps me sorting it out and implementing properly. I don't expect myself to have enough time to develop it in the nearest future. However, I'd happily guide anyone who's interested.
  2. What should the parent parameter contain? I haven't found it mentioned in neither postcss-loader source code nor Webpack docs.
  3. Since the plugin delegates its function handling to postcss-function it has no access to the result at the moment output is applied. So, I've tried to collect the messages while resolving functions, and after everything is done push them at once. You may check how it works on that branch. However, I'm concerned about the validity of this approach.

borodean avatar Nov 07 '16 03:11 borodean

parent should contains Node#source.input.file

ai avatar Nov 07 '16 14:11 ai

It is not so important right now, we could wait :)

ai avatar Nov 07 '16 14:11 ai