Git Product home page Git Product logo

Comments (5)

alexanderniebuhr avatar alexanderniebuhr commented on June 12, 2024 1

pls try and submit pr, i will review (i am currently working on new tests.. sorry for short answers)

from svelte-windicss-preprocess.

alexanderniebuhr avatar alexanderniebuhr commented on June 12, 2024

pr are welcome, you are looking wrong. windicss expressions != template literals look here

export function convertTemplateSyntax(content: string): string {
// converts content temporarily from special svelte syntax to more generic syntax for parsing ...
// from : <div class={`green ${myClass ? 'red' : 'green'}`}>Should be red!</div>
// to : <div class="green {myClass ? 'red' : 'green'}">Should be red!</div>
let parsedContent = content;
// needs make sure length and position are the same, so replacing with spaces
parsedContent = parsedContent.replace(/\{`/g, '" ');
parsedContent = parsedContent.replace(/`\}/g, ' "');
parsedContent = parsedContent.replace(/\$/g, " ");
return parsedContent
}

from svelte-windicss-preprocess.

alexanderniebuhr avatar alexanderniebuhr commented on June 12, 2024

but you might not be able to use the styles like you do i am afraid, but try, you might wait for #35

from svelte-windicss-preprocess.

grenierdev avatar grenierdev commented on June 12, 2024

@alexanderniebuhr Thanks for the pointer.

If we take the same example described in the convertTemplateSyntax

// converts content temporarily from special svelte syntax to more generic syntax for parsing ...
// from : <div class={`green ${myClass ? 'red' : 'green'}`}>Should be red!</div>
// to : <div class="green {myClass ? 'red' : 'green'}">Should be red!</div>

That function actually generates 2 spaces after green.

<div class="green  {myClass ? 'red' : 'green'}">Should be red!</div>
                  ^ extra space introduced by replacing the dollar sign with a space

I'm still new to the svelte syntax, but wouldn't it be better to .replace(/\$\{/g, '{') ?

from svelte-windicss-preprocess.

grenierdev avatar grenierdev commented on June 12, 2024

Settled with class="resizer {'resizer--'+axe}"

from svelte-windicss-preprocess.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.