summaryrefslogtreecommitdiff
path: root/packages/astro-parser/src/parse/index.ts
diff options
context:
space:
mode:
authorGravatar Tony Sullivan <tony.f.sullivan@outlook.com> 2021-07-23 19:51:27 +0200
committerGravatar GitHub <noreply@github.com> 2021-07-23 13:51:27 -0400
commit294a656ed92707939dbd3b771c31a5d6a8a05024 (patch)
tree8ec79481b8813cbc7061170eb3f895e3c66b2e07 /packages/astro-parser/src/parse/index.ts
parent041788878d6091a9b5a064068cbacdb4761700ca (diff)
downloadastro-294a656ed92707939dbd3b771c31a5d6a8a05024.tar.gz
astro-294a656ed92707939dbd3b771c31a5d6a8a05024.tar.zst
astro-294a656ed92707939dbd3b771c31a5d6a8a05024.zip
Introduce `<style global>` (#824)
* Adding support for multiple <style> blocks * Adding support for `<style global>` * scoping @keyframes should also be skipped for <style global> * Adding test coverage for muliple style blocks, global blocks, and scoped keyframes * docs: Updating docs for `<style global>` support * Adding yarn changeset * Punctuation fix in styling docs * docs: Clarifying example use cases given in the docs Co-authored-by: Tony Sullivan <tony.f.sullivan@gmail.com>
Diffstat (limited to 'packages/astro-parser/src/parse/index.ts')
-rw-r--r--packages/astro-parser/src/parse/index.ts14
1 files changed, 1 insertions, 13 deletions
diff --git a/packages/astro-parser/src/parse/index.ts b/packages/astro-parser/src/parse/index.ts
index ef33bfaca..776d46e2b 100644
--- a/packages/astro-parser/src/parse/index.ts
+++ b/packages/astro-parser/src/parse/index.ts
@@ -226,18 +226,6 @@ export class Parser {
export default function parse(template: string, options: ParserOptions = {}): Ast {
const parser = new Parser(template, options);
- // TODO we may want to allow multiple <style> tags —
- // one scoped, one global. for now, only allow one
- if (parser.css.length > 1) {
- parser.error(
- {
- code: 'duplicate-style',
- message: 'You can only have one <style> tag per Astro file',
- },
- parser.css[1].start
- );
- }
-
// const instance_scripts = parser.js.filter((script) => script.context === 'default');
// const module_scripts = parser.js.filter((script) => script.context === 'module');
const astro_scripts = parser.js.filter((script) => script.context === 'setup');
@@ -264,7 +252,7 @@ export default function parse(template: string, options: ParserOptions = {}): As
return {
html: parser.html,
- css: parser.css[0],
+ css: parser.css,
// instance: instance_scripts[0],
module: astro_scripts[0],
meta: {