Skip to content

Conversation

@underfin
Copy link
Member

No description provided.

@yyx990803
Copy link
Member

Could you update this one based on #500?

@underfin
Copy link
Member Author

underfin commented Dec 2, 2019

Year. I will work it.

@underfin
Copy link
Member Author

underfin commented Dec 2, 2019

<img src="./logo.png" srcset="./logo.png 2x"/>
<img src="./logo.png" srcset="./logo.png 2x"/>

Like this. The hoisted expression is const _hoisted_1 = _imports_0 + '2x'.This should can be reuse with hoist
same style and the same url with same fragment.The optimize is not implement. Should add this to TransformContext, like this blow, imports add like this as well.

export interface TransformContext extends Required<TransformOptions> {  
  hoist(exp: JSChildNode): SimpleExpressionNode
}

hoist(exp) {
     if(// same exp){
        // return existing exp
     }
      context.hoists.push(exp)
      return createSimpleExpression(
        `_hoisted_${context.hoists.length}`,
        false,
        exp.loc,
        true
      )
    },

@yyx990803 yyx990803 merged commit cf2a0b2 into vuejs:master Dec 3, 2019
@vue-bot
Copy link
Contributor

vue-bot commented Dec 3, 2019

Hey @underfin, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚

@underfin underfin deleted the transformSrcset branch December 3, 2019 06:06
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.

3 participants