【问题标题】:Rails using TinyMCE content_css does not link properly in production mode使用 TinyMCE content_css 的 Rails 在生产模式下无法正确链接
【发布时间】:2014-01-16 04:37:45
【问题描述】:

您好,我正在尝试使用 tinymce 并让一切都在调试模式下工作。这是我的 js.erb 文件中的代码:

function tinymce_load(){
  tinymce.init({
    selector: "textarea.mceEditor",
    plugins: [
     "advlist autolink lists link image charmap print preview anchor",
     "searchreplace visualblocks code fullscreen autoresize",
     "insertdatetime media table contextmenu paste textcolor"
    ],
    menu : "core",
    toolbar1: "bold italic | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
    toolbar2: "cut copy paste | searchreplace | bullist numlist outdent indent blockquote | undo redo | link unlink anchor image media code | preview | forecolor backcolor",
    toolbar_items_size: 'small',
    content_css : "<%= asset_path 'website.css' %>"
  });
}

我的问题是当我在生产模式下运行时找不到资产 website.css。我认为这是因为当我编译我的资产时,它会将它们编译成一个 css 文件。有没有办法让它工作?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 tinymce


    【解决方案1】:

    检查您的asset_path

    同时检查/(斜线)

    类似的东西

    content_css : "<%=asset_path '/website.css' %>"
    

    【讨论】:

      【解决方案2】:

      所以为了让它工作,我只是添加了整个应用程序 css:

      content_css : "<%=asset_path 'application.css' %>"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-02-02
        • 1970-01-01
        • 1970-01-01
        • 2022-10-17
        相关资源
        最近更新 更多