Wednesday 15 June 2011

javascript - Combine js & css: how to deal with relative paths? -



javascript - Combine js & css: how to deal with relative paths? -

i have php system, view objects can inlcude css , js files via core function. scheme combines included js , css files min.css , min.js , site utilize two. problem is, files contains relative paths , minified ones @ location, have bunch of broken links. can write absolute paths, when load 3rd party library, problem occur (and don't want overwrite them obviously). don't utilize method libs, wonder there solution kind of problem?

maybe should this:

<script> var base_url = <?=get_base_url();?> </script> <script type="text/css" src="js/compressed.js"></script>

and in compressed.js, utilize absolute path's this:

(for example, ajax call):

$.get( base_url + 'path/file' , function(data){});

the thing solution have refactor code..

javascript css relative-path

No comments:

Post a Comment