- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用 flex 和 encore 的 Symfony4 项目。我要添加tinymce。
因此,我添加了tinymce项目:
$ yarn add tinymce
app.js
文件:
require('../css/app.scss');
// Import TinyMCE
import tinymce from 'tinymce/tinymce';
// A theme is also required
import 'tinymce/themes/modern/theme';
// Any plugins you want to use has to be imported
import 'tinymce/plugins/paste';
import 'tinymce/plugins/link';
// Initialize the app
tinymce.init({
selector: 'textarea',
plugins: ['paste', 'link']
});
$ yarn run encore dev
Running webpack ...
DONE Compiled successfully in 17600ms
I 8 files written to public\build
Done in 20.23s.
node_modules/tinymce/skins
目录复制到
/public/build/skins
时,它可以正常工作。但是每次 yarn 编译后我仍然必须这样做
node_modules/tinymce/skins
目录复制到/public/build/skins
? 是否可以更新
webpack.config.js
来做到这一点?
webpack-loader
和
recommandations,但是我不知道该怎么做。
最佳答案
选项1:推荐:内置copyFiles
函数
使用Encore的内置copyFiles
函数。
var Encore = require('@symfony/webpack-encore');
//...
Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
// copy tinymce's skin files
.copyFiles({
from: 'node_modules/tinymce/skins',
to: 'skins/[path]/[name].[ext]'
})
Encore's API reference。
yarn add copy-webpack-plugin --dev
我编辑了webpack.config.js仅添加了4行:
var Encore = require('@symfony/webpack-encore');
//DECLARATION OF THE NEW PLUGIN
var CopyWebpackPlugin = require('copy-webpack-plugin');
Encore
// the project directory where all compiled assets will be stored
.setOutputPath('public/build/')
// the public path used by the web server to access the previous directory
.setPublicPath('/build')
// will create public/build/admin/app.js and public/build/admin/app.css
.addEntry('admin', './assets/js/app.js')
//Some project lines
//...
//...
//I call the plugin with its new syntax (since 3.11)
.addPlugin(new CopyWebpackPlugin({
patterns: [
// Copy the skins from tinymce to the build/skins directory
{ from: 'node_modules/tinymce/skins', to: 'skins' },
],
}))
//Some project lines
//...
//...
;
// export the final configuration
module.exports = Encore.getWebpackConfig();
关于symfony - 如何将Tinymce与Symfony encore集成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48525861/
我试图让 Webpack 处理和复制 src 中的所有图像文件文件夹并将它们输出到 build使用“image-webpack-loader”的文件夹。 据我了解,Webpack 只会对 CSS/SA
我按照文档使 Webpack Encore 在我的项目中工作。 在 webpack.config.js 中导入的 js 文件工作正常,但我在特定页面的 js 中遇到问题:$ is not define
我正在学习使用 webpack-encore并注意到它仅作为 dev 依赖项安装。这是否意味着我应该在开发时编译我的 js 和 css 文件并将它们推送到存储库,然后再推送到生产环境? 在我看来,文档
我正在开发 Symfony 4 应用程序并使用 Symfony 的 Webpack 包装器 Encore。 该应用程序将用于在一个数据库上运行多个站点,每个站点都有不同的主题。主题将是 bootstr
我在 Symfony 4 项目中使用 twig 生成静态 html 页面。我试图用一个简单的循环和 Twig 渲染函数同时生成多个页面。代码如下所示: foreach ($pages as $page
我想用 phpmailer 将图像包含在我的电子邮件中时遇到一个问题。我曾尝试将 swift mailer 与我的 symfony 应用程序一起使用,但没有用我已经尝试了所有配置(所有主机所有端口所有
我想从多个css/js文件创建一个css/js文件。多个addEntry无法正常工作,请检查我的代码并提供解决方案。 var Encore = require('@symfony/webpack-en
我正在尝试将 dropzone 集成到我的 Symfony 4.1 项目中,但我遇到了麻烦。 我通过 npm 将 dropzone 添加到我的项目中:npm install dropzone。 在 a
目录结构 admin/ -> backend webpack js/ .yarnrc webpack.config.js package.json assets/ -> frond w
使用 Symfony 4 和 Webpack + Encore + Yarn,我想在我的模板中处理图像,但我不知道如何实现这一点。 我将图像放在 /assets/img/logo.png 文件夹中,并
配置 我正在使用 webpack-encore和我的 symfony编译我的项目 reactjs项目。到目前为止,我已经使用了基本的 webpack.config.js 设置,它应该可以与 react
我正在设置 webpack.config.js,但我错过了 setOutputPath() 的警告 PhpStorm 消息功能 我有 PhpStorm 的 2018.3.2 版本,我在 Linux D
我有一个关于 Symfony 3.4 中的 Encore 和 Assets 版本控制的问题。 在我的 webpack.config.js我有两种配置。 第一个用于 JS 文件,另一个用于编译 .les
我在使用 webback 和 encore 方面还很陌生,所以我不知道究竟是哪种方法来处理这个问题。 我有一个包含一些 js 文件的网站,它使用 jQuery 和 Bootstrap。我想使用 web
我在 Symfony 4 项目中使用 Webpack Encore,并且在我的 base.html.twig 中包含 JavaScript 的 Twig 帮助器时: {% block javascri
我在升级到 Symfony 4.1 并切换到 Encore 后遇到问题。 Uncaught RangeError: Maximum call stack size exceeded at _typeo
jQuery 不工作,我不能使用我的引导下拉菜单,自定义 javascript ...... 经过 npm run dev (或 npm run build)、app.js文件创建良好并在浏览器中加载
如果我的 webpack 配置中有 enableSingleRuntimeChunk 选项,vuejs 将无法工作。你能告诉我为什么吗? 最佳答案 您必须添加 在你的应用程序中。这可能是问题所在。 关
我想在 Symfony 4 项目中使用 Webpack Encore,当我遵循 Yarn 安装指南时 https://yarnpkg.com/lang/en/docs/install/ ,我收到此错误
我是 Symfony 的初学者,刚刚完成了我的第一个网站。我构建的网站基于 Bootstrap,我使用一些 jquery 来制作我制作的附加 js 文件。 我在使用 Webpack 和 Encore
我是一名优秀的程序员,十分优秀!