Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind config content.transform causes extension to fail loading #77

Closed
EirikFA opened this issue Oct 21, 2024 · 1 comment
Closed

Comments

@EirikFA
Copy link

EirikFA commented Oct 21, 2024

In order for @tailwindcss/container-queries to work, adding a transformer for Razor is required since the @'s used by the plugin have to be escaped (with @@) in Razor. The configuration then looks like this:

content: {
  files: ["./Views/**/*.cshtml"],
  transform: {
    cshtml: content => content.replace(/@@/g, "@"),
  }
}

However, this causes the extension to fail to load with the following trace:

TypeError: content.replace is not a function
    at cshtml (C:\...\tailwind.config.cjs:6:40)
    at Object.<anonymous> (c:\...\appdata\local\microsoft\visualstudio\17.0_ad8f40b8\extensions\5ixbhpjg.ksm\Resources\parser.js:364:58)
    at JSON.stringify (<anonymous>)
    at c:\...\appdata\local\microsoft\visualstudio\17.0_ad8f40b8\extensions\5ixbhpjg.ksm\Resources\parser.js:167:27
    at c:\...\appdata\local\microsoft\visualstudio\17.0_ad8f40b8\extensions\5ixbhpjg.ksm\Resources\parser.js:372:7
    at Object.<anonymous> (c:\...\appdata\local\microsoft\visualstudio\17.0_ad8f40b8\extensions\5ixbhpjg.ksm\Resources\parser.js:373:3)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
Node.js v20.11.1
   at TailwindCSSIntellisense.Configuration.ConfigFileParser.<GetConfigJsonNodeAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at TailwindCSSIntellisense.Configuration.ConfigFileParser.<GetConfigurationAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at TailwindCSSIntellisense.Configuration.CompletionConfiguration.<ReloadCustomAttributesAsync>d__47.MoveNext()
theron-wang added a commit that referenced this issue Oct 22, 2024
@theron-wang
Copy link
Owner

Thank you! This should be fixed in 1.6.2.

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

No branches or pull requests

2 participants