【问题标题】:How Can I set path for generate sourcemap files by autoprefixer-cli or postcss如何通过 autoprefixer-cli 或 postcss 设置生成源映射文件的路径
【发布时间】:2018-04-02 07:29:17
【问题描述】:

我想通过 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 定义路径的源映射文件?

【问题讨论】:

    标签: css command-line-interface postcss autoprefixer


    【解决方案1】:

    PostCSS CLI 插件不提供定义源地图路径的功能,所以恐怕你在这方面不走运。选项包括;

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

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

    【讨论】:

      猜你喜欢
      • 2017-04-12
      • 1970-01-01
      • 1970-01-01
      • 2020-08-27
      • 2023-02-03
      • 1970-01-01
      • 1970-01-01
      • 2019-09-25
      • 1970-01-01
      相关资源
      最近更新 更多