Skip to content

Instantly share code, notes, and snippets.

@Gozala
Created May 10, 2012 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gozala/2653451 to your computer and use it in GitHub Desktop.
Save Gozala/2653451 to your computer and use it in GitHub Desktop.
Spring cleaning
var self = require('self')
var utils = require('my-library/utils')
console.log(self.data.url('icon.png'))
console.log(utils.url('icon.png'))
var self = require('self')
exports.url = function(path) {
return self.data.url(path)
}
@Gozala
Copy link
Author

Gozala commented May 10, 2012

Imagine you have following file layout:

layout

where source of my-addon/lib/main.js and my-library/lib/utils.js is shown above. Before
spring cleaning execution of cfx run from my-addon directory would have logged two different URLs one pointing to a file in the my-addon/data/ folder and another to a file in my-library/data/. After spring cleaning cfx run will log same URL twice, that's because self will be the same regardless of package module is coming from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment