youthfulhps / tailwind-converter Goto Github PK
View Code? Open in Web Editor NEWConverts files written in styled-components to tailwindCSS.
License: MIT License
Converts files written in styled-components to tailwindCSS.
License: MIT License
#! /usr/bin/env node
console.log('Hello world");
{
...
"bin": {
"hello": "./bin/index.js"
}
}
~$ pnpm install -g {패키지 로컬 디렉토리 경로}
치면 에러가 발생하는데, pnpm에서 글로벌 설치를 위해서 경로 설정을 하라는 이야기.
그대로 따라해주면 됨.
~$ hello
> Hello world
컴포넌트 사용처에서 궁극적으로 classNames에 정의된 스타일을 주입하려면 아래 객체 키까지 접근해야 한다.
ast.program.body[4].body.body[0].argument.openingElement.attributes[0].value.extra.rawValue
ast.program.body[4].body.body[0].argument.openingElement.attributes[0].value.extra.raw
ast.program.body[4].body.body[0].argument.openingElement.attributes[0].value.value
ast.program.body
배열이 가지고 있는 declarations
중 선언 타입이 VariableDeclaration
인 경우declaration
의 id.type === Identifier
인 경우declaration
의 init.type === TaggedTemplateExpression
인 경우declaration
의 init.tag.object.type === Identifier
이고, init.tag.object.name === styled
인 경우추출하고자 하는 속성들은 컴포넌트 이름, 사용된 태그, 스타일 속성이다.
name: declaration.id.name // (변수 선언의 이름)
tag: declaration.init.tag.property.name // (사용된 태그)
styles: declaration.init.quasi.quasis[0].value.raw // (처리되지 않은 스타일 속성 문자열, declaration.init.quasi.type === TemplateLiteral)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.