Closed xavianaxw closed 7 years ago
I feel like what you really want is to use modernizr through webpack.
@joemidi Never tried this. Seems like a better option for me. Just curious why my build didn't complete for gulp-modernizr
I'm trying https://www.npmjs.com/package/modernizr-webpack-plugin but I'm getting error:
TypeError: TASK_CONFIG.javascripts.plugins is not a function
My config:
const ModernizrWebpackPlugin = require('modernizr-webpack-plugin')
module.exports = {
html : false,
images : true,
fonts : true,
static : false,
svgSprite : true,
ghPages : false,
stylesheets : true,
javascripts: {
entry: {
// files paths are relative to
// javascripts.dest in path-config.json
app: ['./app.js']
},
plugins: [
new ModernizrWebpackPlugin({
"classPrefix": "",
"options": [
"setClasses"
],
"feature-detects": [
"css/calc"
]
})
]
}
}
I finally used: https://github.com/peerigon/modernizr-loader
My working config:
const path = require('path')
module.exports = {
html : false,
images : true,
fonts : true,
static : false,
svgSprite : true,
ghPages : false,
stylesheets : true,
javascripts: {
entry: {
// files paths are relative to
// javascripts.dest in path-config.json
app: ['./app.js']
},
loaders: [
{
test: /\.modernizrrc/,
loader: 'modernizr-loader!json-loader'
},
],
alias: {
modernizr: path.resolve(process.env.PWD, './.modernizrrc')
}
}
}
And I have .modernizrrc file in project root.
Where would one be able to configure the options for modernizr @illycz ?
In .modernizrrc here is all options from Modernizr: https://github.com/Modernizr/Modernizr/blob/master/lib/config-all.json
If you want add classes to html you must include setClasses
option.
Ah yes silly me. Thanks for this @illycz 👍
What I'm trying to do is add Modernizr to check for touch events
Blendid Version 4.1.1
Problem
As per the title, I'm unable to compile and run my dev server once I added the additionalTask to my
task-config
. This is a fresh install with nothing out of the ordinary.Here's my
task-config.js
Here's my output with
yarn run blendid
The gist that is missing
Package Installed gulp-modernizr
yarn run blendid -- build
also doesn't output any modernizr file.Any advice to the right direction would be greatly appreciated!