volojs / volo

Create front end projects from templates, add dependencies, and automate the resulting projects
https://volojs.github.io/
Other
1.41k stars 99 forks source link

require config paths lead to error in build #136

Closed scips closed 11 years ago

scips commented 11 years ago

Hi,

I'm new to volo so maybe this is already explained somewhere but I didn't find it nor I didn't find any example of the kind of app i'm doing.

I have this kind of file structure: . ./css ./css/app.css ./css/loading.css ./css/install-button.css ./css/global.css ./img ./img/glyphicons-halflings.png ./img/glyphicons-halflings-white.png ./img/.gitignore ./img/icons ./img/icons/mortar-48.png ./img/icons/mortar-128.png ./img/icons/mortar-16.png ./index.html ./.htaccess ./manifest.webapp ./js ./js/application ./js/application/controllers ./js/application/controllers/screen1.coffee ./js/application/controllers/loading.coffee ./js/application/controllers/controller.js ./js/application/controllers/loading.js ./js/application/controllers/screen3.js ./js/application/controllers/screen2.coffee ./js/application/controllers/controller.coffee ./js/application/controllers/screen2.js ./js/application/controllers/screen1.js ./js/application/controllers/screen3.coffee ./js/application/views ./js/application/views/loadingScreen.js ./js/application/views/screen1Screen.js ./js/application/views/screen3Screen.js ./js/application/views/screen.coffee ./js/application/views/screen2Screen.js ./js/application/views/screen3Screen.coffee ./js/application/views/screen1Screen.coffee ./js/application/views/screen.js ./js/application/views/loadingScreen.coffee ./js/application/views/screen2Screen.coffee ./js/application/models ./js/application/models/application.coffee ./js/application/models/settings.js ./js/application/models/api.js ./js/application/models/input.coffee ./js/application/models/api.coffee ./js/application/models/statemachine.coffee ./js/application/models/statemachine.js ./js/application/models/settings.coffee ./js/application/models/input.js ./js/application/models/application.js ./js/lib ./js/lib/layouts ./js/lib/layouts/footer.js ./js/lib/layouts/css ./js/lib/layouts/css/layouts.less ./js/lib/layouts/css/layouts.css ./js/lib/layouts/header.js ./js/lib/layouts/README.md ./js/lib/layouts/css-animations.js ./js/lib/layouts/anim.js ./js/lib/layouts/layouts.js ./js/lib/layouts/list.js ./js/lib/layouts/view.js ./js/lib/receiptverifier.js ./js/lib/backbone.js ./js/lib/microevent.js ./js/lib/install.js ./js/lib/underscore.js ./js/lib/zepto.js ./js/lib/require.js ./js/lib/x-tag.js ./js/app.js ./js/init.js ./js/install-button.js ./js/input.js ./fonts ./fonts/coda-regular.ttf ./favicon.ico

where each view of my application is linked to a specific controller/view ...

I'm trying to use volo for building it instead of ant

Vovlo trigger an error when trying to build a project with specific paths added in the require js config:


require.config({
    baseUrl: 'js/lib',
    paths: {
      application: '../application'
    }
});

requirejs(['../app']);

it gives a nice:

$ volo build
Optimizing (standard.keepLines) CSS file: /var/www/github/catchme/www-built/css/app.css
Optimizing (standard.keepLines) CSS file: /var/www/github/catchme/www-built/css/loading.css
Optimizing (standard.keepLines) CSS file: /var/www/github/catchme/www-built/css/install-button.css
Optimizing (standard.keepLines) CSS file: /var/www/github/catchme/www-built/css/global.css
Optimizing (standard.keepLines) CSS file: /var/www/github/catchme/www-built/js/lib/layouts/css/layouts.css

Tracing dependencies for: ../app
Error: ENOENT, no such file or directory '/var/www/github/catchme/www-built/js/lib/application/models/application.js'
In module tree:
    ../app

Error: ENOENT, no such file or directory '/var/www/github/catchme/www-built/js/lib/application/models/application.js'
In module tree:
    ../app

    at Object.openSync (fs.js:240:18)

ERROR: Error

which could be failing if path where not maping any require js dependcies from application to ../application/

Maybe I'm miss using it.

If you have any advise, I take it.

jrburke commented 11 years ago

You just need to inform r.js, which is used by that volofile's volo build command, about the paths. The tools/build.js file has the build options passed to r.js. You can either duplicate the paths config there, or, use mainConfigFile to specify the path to the .js file that has that config call.

scips commented 11 years ago

Great !!!

Thank you.

here is my build.js file for info


({
    baseUrl: "js/lib",
    map: { '*': { 'jquery': 'zepto' } },
    dir: "../www-built",
    appDir: "../www",
    removeCombined: true,
    modules: [
        { name: "../app" }
    ],
    paths: {
      application: "../application"
    }
})

Happy "Mozilla Firefox OS App Days"!