简体   繁体   English

我可以用另一种方式生成顺风 css 吗?

[英]Can I generate tailwind css in another way?

I would like to generate all the grid related css to a file with a few modifications like prefix and media queries using the tailwind.config.js file, without having to have them specified in a html,js,framework file?我想使用tailwind.config.js文件将所有与网格相关的css生成到一个带有一些修改(如前缀和媒体查询)的文件中,不必在html,js,框架文件中指定它们?

Is that possible?那可能吗?

As I can see it now purge/safelist with a regex is the option?如我所见,现在可以选择使用正则表达式清除/安全列表吗?

like喜欢

module.exports = {
  purge: {
    enabled: true,
    options: {
      safelist: ['/place-/g', '/justify-/g']
    }
  }
}

Thankful for any help on this.感谢您对此的任何帮助。

Please note , I'm not into in setting up a "fake html page" with classes, as my use case might grow overtime.请注意,我不喜欢设置带有类的“假 html 页面”,因为我的用例可能会随着时间的推移而增长。

If I understand your question correctly, think you're just missing the content criteria & the standard key for the safelist object?如果我正确理解您的问题,认为您只是缺少安全列表 object 的content标准和standard密钥?

  purge: {
        content: ["./src/**/*.{html,js,svelte,ts}",],
        enabled: true,
        options: {
            safelist: {
                standard: [/^grid-col/, /^grid-row/]
            }
        }
    },

This may be useful to you: https://purgecss.com/safelisting.html#in-the-css-directly这可能对您有用: https://purgecss.com/safelisting.html#in-the-css-directly

-- --

If you just need tailwind grids, perhaps an alternative like this may help: https://github.com/VeronQ/tailwind-grid如果您只需要顺风网格,也许这样的替代方案可能会有所帮助: https://github.com/VeronQ/tailwind-grid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM