Closed vmariano closed 10 years ago
Yes, the code we are trying to migrate is here nodejs-starter
And the file which does the actual build is in bin/njs-build
for the moment.
We have a component.json
file at the root of the app which has a path: lib
and local: boot
which is the main component.
But in lib/boot/index.jade
we have to include the boot
component this way: require('./lib/boot')
instead of this: require('boot')
as we think it should be, as it is relative to the lib
directory.
Same goes for assets, they are copied in public/lib/boot/images/bg.jpg
instead of public/boot/images/bg.jpg
.
What are we missing?
I just look over your project and I found this : https://github.com/slifszyc/nodejs-starter/blob/5f95ac2cbb2388732dca51abb2293dd958e18950/component.json#L9
local
was renamed to locals
since component v1 => changelog
I rename local to locals and still have the same issue.
I have updated it in https://github.com/slifszyc/nodejs-starter/blob/component1/component.json#L9 but still same results.
Every js is aliased like
require.register("./lib/homepage", function (exports, module) {
/**
* Module dependencies.
*/
var page = require('visionmedia~page.js@1.3.7');
var domify = require('component~domify@1.2.2');
var empty = require('yields~empty@0.0.1');
var splash = require('./lib/homepage/splash.jade');
page('/', function(ctx, next) {
var container = document.querySelector('section.site-content');
empty(container)
.appendChild(domify(splash()));
});
});
Insead of
require.register("homepage", function (exports, module) {
...
)};
And every asset is copied to public/
under public/lib/boot/images/bg.jpg
for example, instead of public/boot/images/bg.jpg
I think this just changed as well, but was not listed in the change log @jonathanong can you confirm that it was desired to change the require and assets paths?
ok, so... the app.js
is being built correctly with the
require.register("./lib/homepage", function (exports, module) {
...
)};
But when I'm writing a .styl
file for example this one: https://github.com/slifszyc/nodejs-starter/blob/component1/lib/boot/index.styl#L2
In the resulting app.css
after building I get background: url("images/bg.jpg") top center fixed;
Instead of background: url("/lib/boot/images/bg.jpg") top center fixed;
you need to use the css rewrite builder plugin
Ok to clarify this I was using:
builder.plugin.urlRewrite('')
builder.plugin.urlRewrite('lib/')
builder.plugin.urlRewrite('lib')
And no one of this works in my local environment. @slifszyc try in his environment and works perfectly. So idk what happen.
thanks for the help guys.
what is your environment? maybe component 0.19 ?
No , 1.0.0@rc5
Also my environment was clone of the environment of @slifszyc I will take a look more deeply to understand what happen.
Hi, I'm trying to migrate component from 0.9 to 1.0.0. We made a great progress with the css/stylus files but we have a little issue with the assets. In to the target folder the assets are located
<local components folder>/<component with assets>/images/image.jpg
I was looking for an example of url rewriting for css/stylus or some to specify the absolute path in to the build folder. Sorry if is a stupid question but I'm really lost with this.