0

I want to precompile my ember templates. I installed an application for that, but I can only precompile one file.

I need like to select all files with .hbs extension including subfolders

I tried ember-precompile "components/**/*.hbs" -f precompiledTemplates.js

I get error saying

Error: ENOENT, no such file or directory 'components\**\*.hbs'

How do I say the program to look for .hbs files in all subfolders ?

Tomas
  • 1,377
  • 3
  • 17
  • 32

2 Answers2

0

I figured it's probably not a windows problem, but a limitation of the library I wanted to use(ember-precompile).

Instead I chose to use gulp which works well https://www.npmjs.org/package/gulp-ember-handlebars

Here's my coffeescript gulpfile for precompiling ember templates. After initiating gulp, it compiles my templates, and if one of templates changes, gulp recompiles.

gulp = require("gulp")
concat = require("gulp-concat")
handlebars = require("gulp-ember-handlebars")

gulp.task( "default", ["precompile-ember-templates"], ()->
    # default tasks complete
)

gulp.task( "precompile-ember-templates", ()->

    console.log("recompiling templates")

    gulp.src( ["client/components/**/*.hbs"] )
        .pipe( handlebars({outputType: 'browser'}) )
        .pipe( concat("templates-compiled.js") )
        .pipe( gulp.dest("client/public/") )
)

gulp.watch( "client/components/**/*.hbs", ["precompile-ember-templates"] )
Tomas
  • 1,377
  • 3
  • 17
  • 32
0

There does seem to be a limitation within the Ember-Precompile code when handling the windows file structure and wildcards.

When running ember-precompile on windows you must do so through a cygwin terminal or similar (in my case I use git bash).

As an example in git bash when I type the line below in my project folder it works for me: ember-precompile templates/*.handlebars -f templates/templates.js

B100
  • 1
  • 1