Comments (4)
Haven't tried tailwind 2.x but I'm guessing the theme variable is already declared in the tailwind config object. You can name the theme import whatever you want since it's a default export, for example:
import myTheme from './theme`
and then use it like this:
theme: {
colors: {
...myTheme.colors
}
from figma-tailwindcss.
Going to close this since this isn't really an issue with the plugin. If you have any other questions, feel free to reach out to me.
from figma-tailwindcss.
I know this is isn't really an issue with the plugin but I am unable to extend tailwind.config.js
with the generated theme.js
so every time I make changes on Figma I only have to paste the new file.
What is working
You hard copy and paste the content of const theme = { <your theme config> }
in tailwind.config.js
as it follows:
module.exports = {
purge: {
. . .
},
darkMode: false, // or 'media' or 'class'
theme: {
// i.e.
extend: {
colors: {
Green: '#60dcb0',
Orange: '#feb881',
Blue: '#5ecad8',
Pink: '#f66295',
Grey: '#6f6f6f',
Hover: '#f8b16f',
Normal: '#f38219',
Active: '#9f5108',
'Light-Green': '#f2fffb',
'Light-Orange': '#fffbf2',
'Light-Blue': '#f2feff',
'Light-Pink': '#fff2f8',
'Light-grey': '#f2f6f7',
'BG-grey': '#f5f5f5',
},
boxShadow: {
'Glow-Green': '0px 34px 40px -15px rgba(17,205,138,0.3)',
'Glow-Orange': '0px 34px 40px -15px rgba(250,165,38,0.3)',
'Glow-Blue': '0px 34px 40px -15px rgba(18,178,200,0.3)',
'Glow-Pink': '0px 34px 40px -15px rgba(238,72,129,0.2)',
},
borderRadius: {
none: '0',
xs: '0.125rem',
sm: '0.3125rem',
default: '0.625rem',
lg: '1.875rem',
},
},
},
variants: {
extend: {},
},
plugins: [],
}
What is not working
- Trying to
import
orrequire
a module and assign it to tailwind configtheme:
property
const MyTheme = require('./theme')
module.exports = {
purge: {
. . .
},
darkMode: false, // or 'media' or 'class'
theme: MyTheme,
variants: {
extend: {},
},
plugins: [],
}
- Imports like
import myTheme from './theme'
are NOT allowed intaiwind.config.js
Thanks you for your work and your support
from figma-tailwindcss.
if you remove the export statement from the generated file you can import it in your tailwind config like so:
const myTheme = require('./theme');
the import
syntax gives some errors but it does work.
Once you have the imported myTheme variable (don't use theme since that's a key already existing in your tailwind config), you have to do it per key. For example with the spread operator (adding your values to some defaults):
fontFamily: {
sans: [
'system-ui',
....
],
serif: ['Georgia', 'Cambria', '"Times New Roman"', 'Times', 'serif'],
mono: ['Menlo', 'Monaco', 'Consolas', '"Liberation Mono"', '"Courier New"', 'monospace'],
...myTheme.fontFamily
},
That's a nice way to use TailwindCSS's default values (you can output a tailwind config with all the values in it using npx tailwindcss init --full
) and extend them with your own from the theme file.
from figma-tailwindcss.
Related Issues (14)
- [Feature] Configurable base size HOT 3
- [Feature] Additional exports HOT 3
- [Feature] border-radius HOT 1
- [BUG]the plugin is NOT working HOT 1
- Value has no property HOT 7
- [BUG] Plugin crashes when style with background blur is defined HOT 1
- [BUG] xs font size not exported correctly HOT 3
- Colors not grouped? HOT 3
- How to use this? HOT 1
- [Feature] Generate text styles as components HOT 1
- [BUG] HOT 5
- TypeError: cannot read property 'color' of undefined HOT 2
- [BUG] no longer works with new Figma update? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from figma-tailwindcss.