Coder Social home page Coder Social logo

Comments (6)

havenchyk avatar havenchyk commented on June 21, 2024

we can render a script from a taglib or a view

Could you show an example, where is it needed? You want to render your script with values from server? I might be wrong, but IMO js should be stored separately from groovy code. But it is only my opinion 😸

from grails-asset-pipeline.

davydotcom avatar davydotcom commented on June 21, 2024

Inline coffee script is not recommended so we definitely do not support that as you should really try to keep all Js out of the page , however to get your scripts at the bottom site mesh provides the content tag and pageProperty tag that make this feasible

Sent from my iPhone

On Jan 13, 2014, at 11:11 PM, Martín Caballero [email protected] wrote:

With the resources plugin we can render several script tags at the end of the page all together. How can be this be accomplished in a similar way to the resources plugin?

For example we can render a script from a taglib or a view using:

Is there a way for also telling that the content is in coffeescript?
Thanks in advance!

PS: maybe this is not an issue, if so I apologize! ;)
PS2: if there is not a feature to accomplish this, is it wrong to use the resources plugin for this purpose along with the assets plugin?


Reply to this email directly or view it on GitHub.

from grails-asset-pipeline.

mpccolorado avatar mpccolorado commented on June 21, 2024

I edited my first question, sorry for that.
"... site mesh provides the content tag and pageProperty tag ...": Can I use this inside a taglib? I don't see how... :(
The purpose of this is to render javascript from different taglibs and all the javascript code will go to the bottom.

If this doesn't work I don't care to use the resources plugin along with the asset plugin but I prefer to avoid this because it's a small feature to use another plugin.

PS: I'm already using content tag in my page, and I'm calling the taglibs inside one content that is already rendered in the layout. So this maybe difficults this workaround.

Thanks a lot!
Good work with the plugin! I'm happy that I can really use coffeescript and less with this!

from grails-asset-pipeline.

davydotcom avatar davydotcom commented on June 21, 2024

Generally bad practice to inject Js like this.. Instead might consider injecting data attributes and binding to those from an external Js file. Otherwise should be able to save a page property from a Athlon have to check the syntax I'll get back to you

Sent from my iPhone

On Jan 14, 2014, at 8:21 AM, Martín Caballero [email protected] wrote:

I edited my first question, sorry for that.
"... site mesh provides the content tag and pageProperty tag ...": Can I use this inside a taglib? I don't see how... :(
The purpose of this is to render javascript from different taglibs and all the javascript code will go to the bottom.

If this doesn't work I don't care to use the resources plugin along with the asset plugin but I prefer to avoid this because it's a small feature to use another plugin.

Thanks a lot!
Good work with the plugin! I'm happy that I can really use coffeescript and less with this!


Reply to this email directly or view it on GitHub.

from grails-asset-pipeline.

davydotcom avatar davydotcom commented on June 21, 2024

Looks like you can use (within a taglib)

def mytag = { attrs, body
  sitemesh.captureContent([tag: 'javascript'], body)
}

Then in your gsp layout have

<g:pageProperty name="page.javascript"/>

from grails-asset-pipeline.

mpccolorado avatar mpccolorado commented on June 21, 2024

Thanks both of you for your comments! I don't knew that this was a code smell! I will consider your suggestions as the right path!

Thanks!

from grails-asset-pipeline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.