Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

background-image生产未转成base64的问题 #12

Closed
githublyp opened this issue Nov 28, 2018 · 3 comments
Closed

background-image生产未转成base64的问题 #12

githublyp opened this issue Nov 28, 2018 · 3 comments

Comments

@githublyp
Copy link

githublyp commented Nov 28, 2018

问题类型

  • 如何实现某功能
  • 报 BUG
  • 某功能改进建议
  • 新功能建议
  • 文档问题
  • 其他/以上都不是

问题详情

在dev开发环境中background-image会转成base64,但是prod时,没有转换,导致文件不能访问

期望效果

background-image:url('base64:')同时把源文件删除

实际情况

还是相对路径url("../")

问题示例 和 复现步骤

background-image: url("../common/back.png");

问题环境

okam-core 版本:0.3.3
okam-build 版本:0.3.2

运行环境

微信小程序开发工具
@wuhy
Copy link
Collaborator

wuhy commented Nov 29, 2018

@githublyp prod 阶段没有转换,确认下你配置的构建规则有加上base64的处理规则吗,你如果只是 dev 属性下加,肯定不会转换,如果都需要转换,可以参考下述配置:

{
 dev: { // dev 阶段规则
        processors: {
            postcss: {
                options: {
                    plugins: [
                        ['postcss-url', {
                            url: 'inline'
                        }]
                    ]
                }
            }
        }
    },
    prod: { // prod 阶段规则
        processors: {
            postcss: {
                options: {
                    plugins: [
                        ['postcss-url', {
                            url: 'inline'
                        }]
                    ]
                }
            }
        }
    }
}

@wuhy
Copy link
Collaborator

wuhy commented Nov 29, 2018

@githublyp 第二个问题,可以具体点吗?给个代码示例更具体阐述下问题包括现象?

@githublyp
Copy link
Author

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants