svg-px2rem-loader
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

SEMI SVG FILE TOOL

github-build npm-download npm-licence github-commit

This is a development environment which convert svg file px to rem tool

By the way, you probably use svg-inline-loader of matching .svg extension files, So you can get a prop first.

Options

name type default description
rootValue number 32 a root value for convert px to rem, it likes root(html) font-size
isLastLoader boolean false if set true means this loader is the lastest loader for svg file

Example

// webpack.config.js
module: {
  rules: [
      {
          test: /\.svg$/,
          use: [
              {
                  loader: 'svg-inline-loader',
                  options: {
                      removeSVGTagAttrs: false,
                  },
              },
              {
                  loader: path.resolve(__dirname, '../dist/index.js'),
                  options: {
                      rootValue: 32,
                  },
              },
          ],
      },
  ],
},

You can also use it without other svg-laoder like svg-inline-loader

module: {
    rules: [
        {
            test: /\.svg$/,
            use: [
                {
                    loader: path.resolve(__dirname, '../dist/index.js'),
                    options: {
                        rootValue: 32,
                        isLastLoader: true,
                    },
                },
            ],
        },
    ],
},

LICENSE

Package Sidebar

Install

npm i svg-px2rem-loader

Weekly Downloads

3

Version

0.1.3

License

MIT

Unpacked Size

232 kB

Total Files

8

Last publish

Collaborators

  • tangji