withasi / qcdn-url-loader

结合url-loader和qcdn的功能,相当于丰富url-loader的功能,最常见的场景:图片如果大于一定尺寸,则上传到公司的cdn上

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

qcdn-url-loader

描述

结合url-loaderqcdn的功能,相当于丰富url-loader的功能,最常见的场景:图片如果大于一定尺寸,则上传到公司的cdn上

qnpm中有功能一样的qcdn-loader,但是不支持qcdn参数设置

安装

qnpm install --save-dev @q/qcdn-url-loader

使用

webpack的loader中使用,替换url-loader:

        include: /img/,
        use: [
            {
                //loader: 'url-loader',
                loader: '@q/qcdn-url-loader',
                options: {
                    limit: 100,
                    qcdnOptions:{
                        https: true,
                        force: true
                    },
                    name: 'images/[name]-[hash:5].[ext]'
                }
            }
        ]

参数详解:

options中的参数和url-loader保持一致,qcdnOptions和qcdn中的options保持一致 如果不传入qcdnOptions参数,则和url-loader功能一致

维护

有任何疑问请联系(siwangli@360.cn)

About

结合url-loader和qcdn的功能,相当于丰富url-loader的功能,最常见的场景:图片如果大于一定尺寸,则上传到公司的cdn上


Languages

Language:JavaScript 100.0%