Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:42:49+00:00 2026-06-13T02:42:49+00:00

I’m building a project with PHP for server side and Ember.js for the client

  • 0

I’m building a project with PHP for server side and Ember.js for the client side.

i’ve wrote all scripts in CoffeScript, templates in .hbs files and .scss files for the styles, for now i’m using rake-pipeline for compiling all, but i have a couple of problems:

  • How to organize the dependencies
  • How to include scripts in other files
  • How to determine the order of the scripts

for now i have a hardcode AssetFile for sort the scripts in the final .js file but my app become more complex and some files need grows and split into more files but i have the problems before mention.

AssetFile

output BUILD_DIR
input SRC_DIR do
  match '**/*.handlebars' do
    handlebars :precompile => true
    concat '0.js'
  end

  match '**/lib/*.coffee' do
    coffee_script
    concat '1.js'
  end
  match '**/app.coffee' do
    coffee_script
    concat '2.js'
  end
  match '**/controller/*.coffee' do
    coffee_script
    concat '3.js'
  end
end

my project layout is like

Resources/
   assets/
      js/         # Are like my vendors (jquery, ember, etc...)
      images/     # i copy this without process
      styles/     # Here are .scss and .sass files
   scripts/
      templates/  # It's a directory tree with files .hbs 
      controller/ # Dirs with arbitrary names
      lib/
      ...
      main.coffee # main point, ej: App = Rkmax.App.create();App.initialize();

you can see the main trouble is give a correct order when concat .js files generate by coffee compiler, I’ve seen some projects in rails and using the sentence requireinside .coffe files but do not know how to make rake-pipeline understand this sentence.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:42:51+00:00Added an answer on June 13, 2026 at 2:42 am

    After searching for a while. I decided to use instead of rakepipeline, Sprockets has a similar system to compile everything you need

    Gemfile

    gem 'sprockets'
    gem 'sprockets-sass'
    gem 'sass'
    gem 'coffe-script'
    

    Rakefile

    require 'sprockets'
    require 'logger'
    require 'fileutils'
    require 'pathname'
    
    task :compile => :clean do
        sprockets = Sprockets::Environment.new(ROOT)
    
        sprockets.append_path SOURCE_DIR.to_s
    
        %w( app.js vendor.s template.js ).each do |bundle|
            assets = sprockets.find_asset(bundle)
            ext = bundle.split(".")[1]
            name = assets.pathname.basename(assets.pathname.extname)
            FileUtils.mkpath BUILD_DIR.join(ext)
            assets.write_to BUILD_DIR.join(ext, "#{name}.#{ext}")    
        end
    end
    

    Sprockets has "Directive Processor" like

    • require
    • include
    • require_self

    they let me organize dependencies easy. the only thing was that it did not process .handlebars default but i wrote a simple handlebars_template.rb

    handlebars_template.rb

    require 'tilt'
    require 'json'
    
    module Sprockets
      class HandlebarsTemplate < Tilt::Template
        self.default_mime_type = 'application/javascript'    
    
        def prepare
        end
    
        # Compile template data
        def evaluate(scope, locals, &block)
          "Ember.TEMPLATES['#{scope.logical_path.split("/")[1..-1].join("/")}']=Ember.Handlebars.compile(#{data.to_json});\n"
        end
      end
    end
    

    register in the right place and voila! process my templates

    register_engine 'handlebars', ::Sprockets::HandlebarsTemplate
    register_engine 'hbs',        ::Sprockets::HandlebarsTemplate
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I would like to count the length of a string with PHP. The string
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.