Gathering detailed insights and metrics for @alifd/next-theme-loader
Gathering detailed insights and metrics for @alifd/next-theme-loader
Gathering detailed insights and metrics for @alifd/next-theme-loader
Gathering detailed insights and metrics for @alifd/next-theme-loader
A webpack loader for injecting scss variables of theme package to scss file.
npm install @alifd/next-theme-loader
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7 Stars
9 Commits
3 Forks
3 Watchers
4 Branches
10 Contributors
Updated on Jan 30, 2021
Latest Version
1.3.1
Package Id
@alifd/next-theme-loader@1.3.1
Unpacked Size
6.80 kB
Size
2.63 kB
File Count
4
NPM Version
5.6.0
Node Version
8.11.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
A webpack loader for injecting scss variables of theme package to scss file.
npm install babel-plugin-import --save-dev
npm install @alifd/next-theme-loader --save-dev
npm install @alifd/next-theme-webpack-plugin --save-dev
1const path = require('path'); 2const webpack = require('webpack'); 3const ExtractTextPlugin = require('extract-text-webpack-plugin'); 4const ThemePlugin = require('@alifd/next-theme-webpack-plugin'); 5 6module.exports = { 7 entry: { 8 index: './src/index.jsx' 9 }, 10 output: { 11 path: path.join(__dirname, 'build'), 12 filename: '[name].js' 13 }, 14 resolve: { 15 extensions: ['.js', '.jsx'] 16 }, 17 devtool: 'inline-source-map', 18 module: { 19 rules: [{ 20 test: /\.jsx?$/, 21 use: { 22 loader: 'babel-loader', 23 options: { 24 presets: [ 25 'env', 26 'react', 27 'stage-0' 28 ], 29 plugins: [ 30 'add-module-exports', 31 'transform-decorators-legacy', 32 ['babel-plugin-import', { style: true }] 33 ] 34 } 35 }, 36 exclude: /node_modules/ 37 }, { 38 test: /\.css$/, 39 use: ExtractTextPlugin.extract({ 40 use: 'css-loader' 41 }) 42 }, { 43 test: /\.scss$/, 44 use: ExtractTextPlugin.extract({ 45 use: [ 46 'css-loader', 47 'fast-sass-loader', 48 { 49 loader: '@alifd/next-theme-loader', 50 options: { 51 theme: '@alifd/theme-package', /* variables only modified (optional)*/ 52 modifyVars: {'$css-prefix': 'my-'} /* custom variable (optional) */ 53 } 54 } 55 ] 56 }) 57 }] 58 }, 59 plugins: [ 60 new ThemePlugin({ theme: '@alifd/theme-package' }), 61 new ExtractTextPlugin('[name].css') 62 ] 63};
webpack.config.js
1const path = require('path'); 2const webpack = require('webpack'); 3const ExtractTextPlugin = require('extract-text-webpack-plugin'); 4const ThemePlugin = require('@alifd/next-theme-webpack-plugin'); 5 6module.exports = { 7 entry: { 8 index: './src/index.jsx' 9 }, 10 output: { 11 path: path.join(__dirname, 'build'), 12 filename: '[name].js' 13 }, 14 resolve: { 15 extensions: ['', '.js', '.jsx'] 16 }, 17 devtool: 'inline-source-map', 18 module: { 19 loaders: [{ 20 test: /\.jsx?$/, 21 loader: 'babel', 22 query: { 23 presets: [ 24 'es2015', 25 'react', 26 'stage-0' 27 ], 28 plugins: [ 29 'add-module-exports', 30 'transform-decorators-legacy', 31 ['babel-plugin-import', { style: true }] 32 ] 33 }, 34 exclude: /node_modules/ 35 }, { 36 test: /\.css$/, 37 loaders: ExtractTextPlugin.extract('css') 38 }, { 39 test: /\.scss$/, 40 loader: ExtractTextPlugin.extract('css!fast-sass!@alifd/next-theme-loader?theme=@alifd/theme-package') 41 }] 42 }, 43 plugins: [ 44 new ThemePlugin({ theme: '@alifd/theme-package' }), 45 new ExtractTextPlugin('[name].css') 46 ] 47};
theme
(String): theme package(eg: @alifd/theme-1) which come from https://fusion.designbase
(String): package with all variables (eg: @alifd/next)modifyVars
(String/Object): inject some variables, such as: $css-prefix
or $icon-font-path
, value may be the following two types
{ '$css-prefix': '"my-"' }
path.join(__dirname, 'variable.scss')
, it should be an absolute pathNote: if you want to set modifyVars to object under webpack1, you should write as below:
1{ 2 test: /\.scss$/, 3 loader: ExtractTextPlugin.extract(`css!sass!@alifd/next-theme-loader?${JSON.stringify({ theme: '@alifd/theme-package', modifyVars: { '$css-prefix': '"my-"', '$icon-font-path': '"//xxx.com"' } })}`) 4}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More