Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between just modifying Path #1

Open
rtgibbons opened this issue Oct 8, 2014 · 1 comment
Open

Difference between just modifying Path #1

rtgibbons opened this issue Oct 8, 2014 · 1 comment

Comments

@rtgibbons
Copy link

I just ran across this plugin when searching for how to do this on a current project.

I'm curious as to what the difference is between this and just modify the paths config object?

require.config({
  paths : {
    'components/component1': 'components/component1.abcd1234',
    'components/component2': 'components/component2.efgh5678',
  }
});

Looks like either way main.js is going to have be modified after the fingerprinting of the files has been performed with the fingerprint? And a bonus of doing this, we don't have to modify the define's in our existing project?

(Please note, I'm a DevOps guy with backend focus, my knowledge of requriejs is limited, so feel free to point out any flaw I might have, or ask for more clarification if I skipped over something)

@meinaart
Copy link
Owner

meinaart commented Oct 8, 2014

If you have a different fingerprint for every file then that approach is more or less the same ;). I developed it for an environment where we used one fingerprint for every release.

In the end I didn't even use my own plugin that much because we switched to fingerprinting the whole directory and just changed the basePath.

It's still useful if you don't want to give all resources their own unique fingerprint.

If you have a specific wish just let me know. I could also add matching the file name with a regex for example.

If every file has their own unique fingerprint I would choose the path generation approach. Saves you from adding "fingerprint!" with every require call. That's also more readable and friendlier for other developers.

I now only use my plugin for fingerprinting dynamically loaded CSS files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants