expect(result.code).toMatch(`export function render(`)
})
+// #6807
+test('should work with style comment', () => {
+ const source = `
+ <div style="
+ /* nothing */
+ width: 300px;
+ height: 100px/* nothing */
+ ">{{ render }}</div>
+ `
+
+ const result = compile({ filename: 'example.vue', source })
+ expect(result.errors.length).toBe(0)
+ expect(result.source).toBe(source)
+ expect(result.code).toMatch(`{"width":"300px","height":"100px"}`)
+})
+
test('preprocess pug', () => {
const template = parse(
`
const listDelimiterRE = /;(?![^(]*\))/g
const propertyDelimiterRE = /:([^]+)/
+const styleCommentRE = /\/\*.*?\*\//gs
export function parseStringStyle(cssText: string): NormalizedStyle {
const ret: NormalizedStyle = {}
- cssText.split(listDelimiterRE).forEach(item => {
- if (item) {
- const tmp = item.split(propertyDelimiterRE)
- tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim())
- }
- })
+ cssText
+ .replace(styleCommentRE, '')
+ .split(listDelimiterRE)
+ .forEach(item => {
+ if (item) {
+ const tmp = item.split(propertyDelimiterRE)
+ tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim())
+ }
+ })
return ret
}