Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>ok I believe I have a (semi) working solution:</p> <p>Suppose we need to include both Twitter Bootstrap 3 and TinyMce</p> <p>Under webapp directory I create the following directories:</p> <pre><code>resources/bootstrap/ resources/bootstrap/css/ resources/bootstrap/css/bootstrap.min.css resources/bootstrap/fonts/ resources/bootstrap/fonts/glyphicons-halflings-regular.eot resources/bootstrap/fonts/glyphicons-halflings-regular.svg resources/bootstrap/fonts/glyphicons-halflings-regular.ttf resources/bootstrap/fonts/glyphicons-halflings-regular.woff resources/bootstrap/js/ resources/bootstrap/js/bootstrap.min.js resources/jquery/ resources/jquery/jquery-2.0.3.min.js resources/tiny_mce/ resources/tiny_mce/langs/ /*many files here*/ resources/tiny_mce/plugins/ /*many files here*/ resources/tiny_mce/themes/ /*many files here*/ resources/tiny_mce/utils/ /*many files here*/ resources/tiny_mce/tiny_mce_popup.js resources/tiny_mce/tiny_mce_src.js resources/tiny_mce/tiny_mce.js </code></pre> <p>Then I declare my resources in ApplicationResources.groovy</p> <pre><code>modules = { application { resource url:'js/application.js' } jquery { resource url:'resources/jquery/jquery-2.0.3.min.js' } bootstrap { dependsOn 'jquery' resource url:'resources/bootstrap/css/bootstrap.min.css' resource url:'resources/bootstrap/js/bootstrap.min.js' } tinymce { resource url:'resources/tiny_mce/tiny_mce.js' } } </code></pre> <p>And in Config.groovy</p> <pre><code>grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*'] /*no changes here*/ grails.resources.adhoc.excludes = ['/**/langs/**/*.*', '/**/themes/**/*.*'] /*to permit some Ajax calls from tiny_mce.js to relevant resources*/ grails.resources.debug=true /* this is why I call my solution SEMI working. If set grails.resources.debug to false, TinyMce is NOT working because the above excludes are not active, and I receive 404 errors */ </code></pre> <p>Then, in main.gsp </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;head&gt; &lt;g:javascript library="application"/&gt; &lt;g:javascript library="bootstrap"/&gt; &lt;g:javascript library="tinymce"/&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt; &lt;title&gt;&lt;g:layoutTitle default="Grails"/&gt;&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt; &lt;link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon"&gt; &lt;link rel="apple-touch-icon" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}"&gt; &lt;link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'images', file: 'apple-touch-icon-retina.png')}"&gt; &lt;link rel="stylesheet" href="${resource(dir: 'css', file: 'main.css')}" type="text/css"&gt; &lt;link rel="stylesheet" href="${resource(dir: 'css', file: 'mobile.css')}" type="text/css"&gt; &lt;r:layoutResources /&gt; &lt;g:layoutHead/&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="grailsLogo" role="banner"&gt;&lt;a href="http://grails.org"&gt;&lt;img src="${resource(dir: 'images', file: 'grails_logo.png')}" alt="Grails"/&gt;&lt;/a&gt;&lt;/div&gt; &lt;g:layoutBody/&gt; &lt;div class="footer" role="contentinfo"&gt;&lt;/div&gt; &lt;div id="spinner" class="spinner" style="display:none;"&gt;&lt;g:message code="spinner.alt" default="Loading&amp;hellip;"/&gt;&lt;/div&gt; &lt;r:layoutResources /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And in index.gsp</p> <pre><code>&lt;head&gt; ... &lt;script type="text/javascript"&gt; $(function() { tinymce.init({selector:'textarea'}); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; ... &lt;h1&gt;Welcome to Grails&lt;/h1&gt; check bootstrap - start &lt;span class="glyphicon glyphicon-search"&gt;&lt;/span&gt; &lt;button type="button" class="btn btn-default btn-lg"&gt; &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt; Star &lt;/button&gt; check bootstrap - stop &lt;textarea&gt;Your content here.&lt;/textarea&gt; ... &lt;/body&gt; </code></pre> <p>Using the above, I have fully operational JQuery, Bootstrap3 and TinyMCE But if a I set in Config.groovy</p> <pre><code>grails.resources.debug=true </code></pre> <p>I am receiving 404-errors related to the <code>grails.resources.adhoc.excludes</code> resources that TinyMce dynamically fetches after page load.</p> <p>Any clues? I am really close to find the solution so I will glad to get your input This test project can be downloaded from here: <a href="https://docs.google.com/file/d/0B8epX7R4j7jeaVh5OTFiQlV4V0U/edit?usp=sharing" rel="nofollow">https://docs.google.com/file/d/0B8epX7R4j7jeaVh5OTFiQlV4V0U/edit?usp=sharing</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload