GithubHelp home page GithubHelp logo

Comments (6)

netzpirat avatar netzpirat commented on July 21, 2024

That's strange, I have my templates folder also directly in app/assets without problems. Can you try to add your path to the assets path in your environment config:

config.assets.paths << "#{ Rails.root }/app/assets/templates"

from haml_coffee_assets.

netzpirat avatar netzpirat commented on July 21, 2024

You can now enable the Sprockets JST processor by switching to the .jst.hamlc extension, so Haml Coffee Assets isn't responsible for creating the JST.

I'm closing this since it's not related to Haml Coffee Assets, it's a Sprockets configuration issue. The way it's describe in the README is just my personal setup, but you can configure Sprockets to your needs easily.

from haml_coffee_assets.

dukejones avatar dukejones commented on July 21, 2024

It's actually working without error now without that change for some reason.

The real reason I asked for the change was that I wanted my templates in my javascripts/ directory alongside my models/ routers/ and views/ directories. But I'll give this a shot and see how it feels.

from haml_coffee_assets.

jingoro avatar jingoro commented on July 21, 2024

I ran into a similar issue. Putting templates in app/assets/templates can lead to a path collisions. For example, if you have both of the following it will lead to only one being loaded in the development environment:

  • app/assets/javascripts/foo.js
  • app/assets/templates/foo.hamlc

I would recommend re-opening this issue because I don't think putting the templates in app/assets works out of the box. I handled this by:

  1. putting templates in app/assets/javascripts/templates
  2. modifying the evaluate method in HamlCoffeeAssets::HamlCoffeeTemplate to use a customizable name_filter proc.

See https://github.com/jingoro/haml_coffee_assets/commit/309d1428c42a750df0cacfaf48ca3a84be4db8a8

Let me know what you think about this general approach.

from haml_coffee_assets.

netzpirat avatar netzpirat commented on July 21, 2024

This is a very nice solution. I'll pull you commit today and update the README. I'd only change the name_filter to be lambda { |n| n.sub /^templates\//, '' } by default, because I think this is what most people want.

from haml_coffee_assets.

netzpirat avatar netzpirat commented on July 21, 2024

Thanks @jingoro for the nice pull request!

from haml_coffee_assets.

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.