This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add data option to allow prepending style block content
Related #93
- Loading branch information
Showing
5 changed files
with
141 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import vue, { VuePluginOptions } from '../../src' | ||
import { pluginInline } from '../setup/plugins' | ||
import { rollup } from 'rollup' | ||
|
||
describe('data', () => { | ||
async function setup(options?: Partial<VuePluginOptions>) { | ||
return rollup({ | ||
input: '/entry.vue', | ||
plugins: [ | ||
pluginInline( | ||
'/entry.vue', | ||
` | ||
<template> | ||
<div>Hello, world</div> | ||
</template> | ||
<style scoped> | ||
div { | ||
color: red; | ||
} | ||
</style> | ||
` | ||
), | ||
vue({ | ||
...options, | ||
normalizer: 'vue-runtime-helpers/dist/normalize-component.mjs', | ||
styleInjector: 'vue-runtime-helpers/dist/inject-style/browser.mjs', | ||
}) | ||
] | ||
}) | ||
.then(bundle => bundle.generate({ format: 'es' })) | ||
.then(generated => generated.output[0]) | ||
} | ||
|
||
it('prefix', async () => { | ||
const { code } = await setup({ | ||
data: { | ||
css: '/*! © 2019 Jane Doe */\n' | ||
} | ||
}) | ||
|
||
expect(code).toEqual(expect.stringContaining('© 2019 Jane Doe')) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters