gpt4 book ai didi

css - 如何通过 autoprefixer-cli 或 postcss 设置生成源映射文件的路径

转载 作者:行者123 更新时间:2023-11-28 01:56:20 25 4
gpt4 key购买 nike

我想通过 CLI 生成源映射文件到定义的路径。
例如下面。

通过 autoprefixer-cli

> autoprefixer-cli css/style.css -o css/style.css --map SET_PATH_FOR_MAPFILE

以上命令有效,但忽略 SET_PATH_FOR_MAPFILE。
它只是在定义的输出 (-o) 路径中生成源映射文件。


通过 postcss

> postcss --replace css/style.css --use autoprefixer --map SET_PATH_FOR_MAPFILE

以上命令也有效,但忽略 SET_PATH_FOR_MAPFILE。
它只是替换为定义的 css 文件(路径)。


总之,我没有得到我想要的输出。

// expected output
css/style.css
SET_PATH_FOR_MAPFILE/style.prefixed.css.map

// actual output
css/style.css
css/style.css.map

如何生成由 CLI 定义路径的 sourcemap 文件?

最佳答案

PostCSS CLI 插件不提供定义源映射路径的能力,所以恐怕你在那里运气不好。选项包括;

  1. 根本没有标志,sourcemap 默认内联在输出 CSS 文件中
  2. --map,在与输出 CSS 相同的根目录中输出 sourcemap
  3. --no-map,输出没有任何 source map 的 CSS。

更多信息可以在他们的 GitHub page 上找到.

关于css - 如何通过 autoprefixer-cli 或 postcss 设置生成源映射文件的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49607076/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com