Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
gatsby-plugin-less
Advanced tools
Gatsby plugin to add support for using Less
Provides drop-in support for Less stylesheets
npm install gatsby-plugin-less
gatsby-config.js
file.// in gatsby-config.js
plugins: [`gatsby-plugin-less`]
If you need to pass options to the Less loader use the loaderOptions
and to Less use lessOptions
object;
see less-loader
for all available options.
// in gatsby-config.js
plugins: [
{
resolve: `gatsby-plugin-less`,
options: {
loaderOptions: {
appendData: `@env: ${process.env.NODE_ENV};`,
},
lessOptions: {
strictMath: true,
plugins: [new CleanCSSPlugin({ advanced: true })],
},
},
},
]
If you need to override the default options passed into css-loader
Note: Gatsby is using css-loader@^5.0.0
.
// in gatsby-config.js
plugins: [
{
resolve: `gatsby-plugin-less`,
options: {
cssLoaderOptions: {
camelCase: false,
},
},
},
]
Using CSS modules requires no additional configuration. Simply prepend .module
to the extension. For example: app.less
-> app.module.less
.
Any file with the module
extension will use CSS modules. CSS modules are imported as ES Modules to support treeshaking. You'll need to import styles as: import { yourClassName, anotherClassName } from './app.module.less'
.
PostCSS is also included to handle some default optimizations like autoprefixing and common cross-browser flexbox bugs. Normally you don't need to think about it, but if you'd prefer to add additional postprocessing to your Less output you can specify plugins in the plugin options
// in gatsby-config.js
plugins: [
{
resolve: `gatsby-plugin-less`,
options: {
postCssPlugins: [somePostCssPlugin()],
},
},
]
less-loader
options now possible with the object loaderOptions
.less
options moved to the object lessOptions
because of api change on less-loader
v6.less
is moved to a peer dependency. Installing the package
alongside gatsby-plugin-less
is now required. Use npm install less
support Gatsby v2 only
theme
option has been removed. You can pass configuration object to less-loader:
plugins: [
{
resolve: `gatsby-plugin-less`,
options: {
- theme: {
- "text-color": `#fff`,
- }
+ modifyVars: {
+ "text-color": `#fff`,
+ }
},
},
]
plugins: [
{
resolve: `gatsby-plugin-less`,
options: {
- theme: `./src/theme.js`,
+ modifyVars: require(`./src/theme.js`),
},
},
]
FAQs
Gatsby plugin to add support for using Less
The npm package gatsby-plugin-less receives a total of 1,106 weekly downloads. As such, gatsby-plugin-less popularity was classified as popular.
We found that gatsby-plugin-less demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.