gpt4 book ai didi

gatsby - 将自定义 Modernizr 构建添加到 Gatsby 站点

转载 作者:行者123 更新时间:2023-12-05 07:24:10 24 4
gpt4 key购买 nike

将自定义 Modernizr 构建添加到 Gatsby 站点的最佳方法是什么?

一种想法是在 static/ 文件夹中包含一个 modernizr.js 文件,然后在布局组件中包含一个导入该文件的脚本标签。但这并不是对 Gatsby 最友好的方法。

任何其他建议都会非常有帮助!

最佳答案

他们有一个 npm 包 modernizr .也许试试看?

/src/pages/index.js 添加:

// Listen to a test, give it a callback
Modernizr.on('testname', function( result ) {
if (result) {
console.log('The test passed!');
}
else {
console.log('The test failed!');
}
});

关于gatsby - 将自定义 Modernizr 构建添加到 Gatsby 站点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55591828/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com