less-plugin-aliases
A less plugin work with typescript-plugin-css-modules
Last updated 5 years ago by sizhao .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install less-plugin-aliases 
SYNC missed versions from official npm registry.

less-plugin-aliases

A less plugin work with typescript-plugin-css-modules

Work with webpack and typscript-plugin-css-modules

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-plugin-css-modules",
        "options": {
          "classnameTransform": "camelCase",
          "customMatcher": "\\.less$",
          "customRenderer": "node_modules/less-plugin-aliases/lib/customRender.js"
        }
      }
    ],

    // ...
  }
}

Work alone with less

  import less from 'less'
  import LessPluginAliases from 'less-plugin-aliases'

  less.render(css, {
    ...
    plugins: [
      new LessPluginAliases({
        prefix: '~',
        aliases: {
          common: path(__dirname, 'src/common') // resovle to '/workspace/project/src/common'
        }
      })
    ]
  })

index.less

@import '~common/variables.less';

.container {
  padding: 32px;
  font-size: @fontSize;
  background: @white;

  .header-title {
    font-size: 16px;
  }
}

The plugin will resolve ~common/variables.less to /workspace/project/src/common/variables.less.

Current Tags

  • 1.0.3                                ...           latest (5 years ago)

4 Versions

  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (7)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE