Plone / Grok - 在使用“zopeskel plone”构建的产品中,能否与plone.directives产生冲突?(Plone/Grok - In a product built using “zopeskel plone”, can grok conflict with plone.directives?)
我正在尝试按照Plone文档站点上的教程构建一个控制面板。 http://docs.plone.org/develop/plone/functionality/controlpanel.html
但是,我开始使用(来自src文件夹)../bin/zopeskel plone my.product创建产品,而不是使用dexterity选项创建。 当我询问我想要什么模式时,我确实选择了简单选项,当我询问是否要创建GS配置文件时,我确实选择了是。
我确保在configure.zcml中包含grok
<include package="five.grok" />
按照说明操作后,我尝试运行quickinstall来安装产品,但它给了我错误:
ImportError: No module named directives
指的是他们教程的settings.py文件中的行
from plone.directives import form
我将plone.app.registry添加到setup.py文件中的install_requires位,我确保在configure.zcml文件中进行更改以包含Just for experimenting,我确实将'plone.app.dexterity'添加到了install_requires,但我仍然遇到同样的错误。
Grok与plone.directives冲突吗? 如果是这样,我该如何解决这个问题,还是必须使用威慑而不是plone作为创建产品的选项? 如果grok没有冲突,问题是什么?
在附注中,本教程似乎是用灵巧来创建产品的,但我不确定这是否是问题所在。
I am trying to build a control panel following a tutorial on the Plone Documentation site. http://docs.plone.org/develop/plone/functionality/controlpanel.html
However, I started off creating the product with (from the src folder) ../bin/zopeskel plone my.product, instead of creating with the dexterity option. I did select the easy option when it asked what mode I wanted and I did select yes when it asked if I wanted to create a GS Profile.
I made sure to include grok in configure.zcml
<include package="five.grok" />
After following the instructions, I try to run the quickinstall to install the product, but it gives me the error:
ImportError: No module named directives
referring to the line in the settings.py file of their tutorial
from plone.directives import form
I added plone.app.registry to the install_requires bit in the setup.py file, and I made sure to make the changes in the configure.zcml file to include Just for experimenting, I did add 'plone.app.dexterity' to the install_requires, but I still got the same error.
Is grok conflicting with plone.directives? If so, how can I fix this or do I have to use deterity instead of plone as the option for creating products? If grok is not conflicting, what could the problem be?
On a side note, the tutorial does appear to be for using dexterity to create the product, but I am not sure if that is what the problem is.
原文:https://stackoverflow.com/questions/27783677
最满意答案
假设您在条目js中导入bootstrap 4:
import 'bootstrap/scss/bootstrap.scss';
...尝试以下插件设置:
const extractScss = new ExtractTextPlugin({ filename: 'assets/css/[name].[contenthash].css', allChunks: true });
...将以上内容添加到您的插件数组中:
plugins: [extractScss]
......然后在你的规则中:
{ test: /\.scss$/, use: extractScss.extract({ fallback: 'style-loader', //resolve-url-loader may be chained before sass-loader if necessary use: ['css-loader', 'sass-loader'] }) }
所以构建你的ExtracTextPlugin很重要,在这里我已经设置了
const extractScss = new ExtractTextPlugin(...)
这样,在您的规则配置中,您将传递相同的对象。 在上面的代码中,您使用的是ExtractTextPlugin的导入实例,而不是您在插件数组中创建的新实例(没有设置选项)。
你可能不得不调整插件选项中的文件名,我的设置就像资产/ css / main.awef32fq23faf23aasdf.css
Assuming you are importing bootstrap 4 like so in your entry js:
import 'bootstrap/scss/bootstrap.scss';
...try the following plugin setup:
const extractScss = new ExtractTextPlugin({ filename: 'assets/css/[name].[contenthash].css', allChunks: true });
... add the above to your plugins array:
plugins: [extractScss]
... and then in your rules:
{ test: /\.scss$/, use: extractScss.extract({ fallback: 'style-loader', //resolve-url-loader may be chained before sass-loader if necessary use: ['css-loader', 'sass-loader'] }) }
So it's important to construct your ExtracTextPlugin, here I have mine set to the
const extractScss = new ExtractTextPlugin(...)
That way later on in your rules configuration you are passing the same object. In your code above you are using the imported instance of ExtractTextPlugin not the new one you created in your plugins array (which has no options set).
You'll probably have to adjust the filename in the plugin options, mine is set to go to something like assets/css/main.awef32fq23faf23aasdf.css
相关问答
更多-
Webpack 3:使用sass-loader和ExtractTextPlugin不起作用(Webpack 3: Use sass-loader and ExtractTextPlugin doesn't work)[2023-07-10]
问题来自index.html的注释样式代码 。 index.html由html-webpack-plugin ,由于某种原因,它仍然尝试处理require调用( 第9 行和第11行 )。 原因可能是html-webpack-plugin的自定义EJS加载器。 最简单的解决方案是从index.html完全删除注释代码。 通过导入.scss文件,您配置的规则将应用于该文件。 但似乎实际的extract-text-webpack-plugin实例在该过程中不可用。 您正在这些需要调用中使用内联加载程序,但您配置的 ... -
我找到了解决方案: const ExtractTextPlugin = require("extract-text-webpack-plugin"); const extractSass = new ExtractTextPlugin({ filename: "[name].[contenthash].css", disable: process.env.NODE_ENV === "development" }); module.exports = { ... modul ...
-
您已经使用了一些假设为webpack 1的加载器配置。 配置的那一部分: loaders: [ { test: /\.scss$/, loader: ExtractTextPlugin.extract('style-loader', 'css?minimize!postcss!sass') }, { test: /\.(eot|woff|woff2|ttf|svg)(\?\S*)?$/, ...
-
ERROR in ./~/bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.eot Module parse failed: /mnt/4E6E45D36E45B48D/Work/webpack-demo/node_modules/bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.eot Unexpected character '�' (1 ...
-
假设您在条目js中导入bootstrap 4: import 'bootstrap/scss/bootstrap.scss'; ...尝试以下插件设置: const extractScss = new ExtractTextPlugin({ filename: 'assets/css/[name].[contenthash].css', allChunks: true }); ...将以上内容添加到您的插件数组中: plugins: [extractScss] ......然后在你的规则中: ...
-
有我的字体配置 { test: /\.(woff|woff2|ttf|eot)$/, use: 'file?name=fonts/[name].[ext]!static' } 也许是有用的 - - 添加 - - resolve: { extensions: ['.js', '.jsx', '.css', '.less', '.json'], modules: ['node_modules', 'path/to/your/static_resource'] } there ...
-
当然,一旦我发布问题,我就会弄明白。 问题是我需要在我的入口点模块boot.browser.ts中导入style.scss。 这也回答了关于webpack如何知道只编译styles.scss而不是所有bootstrap.scss文件的问题。 Of course, as soon as I post the question, I figure it out. The issue was that I needed to import the style.scss in my entry point modu ...
-
你也在为.css使用stylus-loader 。 但并非所有CSS都是有效的手写笔。 您需要从.css规则中删除stylus-loader : { test: /\.css$/, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: ['css-loader', 'postcss-loader'] }) }, You're using stylus-loader for your .css as wel ...
-
加载Sass时,Webpack ExtractTextPlugin会引发错误(Webpack ExtractTextPlugin throws error when loading Sass)[2022-04-18]
而不是使用 loaders: ExtractTextPlugin.extract("style", "css!sass") 你应该使用 loader: ExtractTextPlugin.extract("style", "css!sass") 代替。 在这种情况下,错误不是特别描述性的。 Instead of using loaders: ExtractTextPlugin.extract("style", "css!sass") you should use loader: ExtractText ... -
您必须在app.js require/import您的scss模块。 You have to require/import your scss module in app.js.