question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] What to do about @css import?

See original GitHub issue

Hi!

I’d love to use jte for the rendering of our HTML email templates, however the css styling contains an @import url("https://..."); for a font, which of course is registered as the @import keyword from jte.

<style type="text/css" rel="stylesheet" media="all">
    @import url("https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap"); /* <--- Right here */
    body {
        width: 100% !important;
        height: 100%;

Thus, this error is generated:

Exception in thread "main" gg.jte.TemplateException: Failed to compile template, error at base-html.jte:14
........./jte-classes/gg/jte/generated/JtebasehtmlGenerated.java:2: error: '.' expected
import url("https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap");;
          ^
1 error

The generated file in turn then also includes the import that was actually meant for rendering in CSS:

package gg.jte.generated;
import url("https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap");;
public final class JtebasehtmlGenerated {

Is there some mechanism to keep these keywords apart, or escape them for jte?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kelunikcommented, Sep 19, 2020

Another way would have been ${"@import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');"}, no?

0reactions
casidcommented, Sep 22, 2020

@KBurgmann the new plugin version got approved by JetBrains: https://plugins.jetbrains.com/plugin/14521-jte/versions/stable/97316

Now the css looks pretty good in IntelliJ: After plugin update

I’m gonna close this now 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

import - CSS: Cascading Style Sheets - MDN Web Docs
The @import CSS at-rule is used to import style rules from other valid stylesheets. An @import rule must be defined at the top...
Read more >
Best way to include CSS? Why use @import? - Stack Overflow
From a page speed standpoint, @import from a CSS file should almost never be used, as it can prevent stylesheets from being downloaded ......
Read more >
What is the best way to include CSS file? Why use @import?
What is the best way to include CSS file? Why use @import? ... CSS property can be include in the HTML page in...
Read more >
Questions Parents Asked About the CSS Profile TM - MEFA
A: The CSS Profile will ask you to include all household members who receive more than half of their support from you and...
Read more >
How to use @font-face in CSS
This format can also include metadata and license info within the font file. This format seems to be the winner and where all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found