What is the typical process with filegroups in chirpy - javascript

I have a filegroup configured with Chirpy:
<FileGroup Name="1.min.js" Minify="False">
<File Path="test/temp1.js" />
<File Path="test/temp2.js" />
</FileGroup>
Now I set my master page to download this script 1.min.js. So far so good but the problem is when I edit some of the script in temp1.js, I have to come in this mash.chirp.config and save this file too for 1.min.js to take updated changes from temp1.js. This is tedious for me. If I forget to save at both place it causes countless minutes to figure out why is it not worknig. Is there any better approach to this?

I feel your pain and have had the same issues. Basically, the way I resolved this is to just tell the page to load the JS file directly. This seems to also play well with the js debugger because the files haven't been minified to a single line.
Then after the js file is complete, I add it to my mash.js.chirp.config file to be combined and minified. I know it's not the answer you were hoping for, but despite having to process it in this manor during development, the payout in the end feels worth it to me.
If you really wanted to force it, you could add code to the web projects properties, in the after build command line to invoke the chirpy console to compile this file. I've used the code for this before, but couldn't find it right now. Some info is here though; Oh and I wouldn't name your file .min.js unless you set minify = true. It could come back to bite you later on if you forget you did that.
I found the link to force the compiler;
http://www.annhoang.net/twitter-bootstrap-in-visual-studio-2010-with-chirpy-and-dotless/

Related

Saving javascript script output to file on server

So far Gurus here helped me a lot so far and I am back again with my little queries again.
I have a js that is being called from a webserver through a internal site I am taking care of. js has lots of very helpful debugging comments through
console.log($output)
that are being displayed on the console. I was wondering if there is any way i can redirect these comments to a log file on server.
I know it is hard but not impossible... I thought of doing something like
> exec 1>>${LOG_FILE}
but then it means it will get outputs from every file will be going to that file.
I only need the output from one file... is it possible?? plus do I need to run it through cron? because I don't have permission to change anything in js itself.
-Thanks

Delete unused files and folders in an existing project

I recently started working on this php project that had some previous developers.
These dev's made a bit of a mess of things, resulting in a huge amount of different files, in PHP as well as javascript files and stylesheets.
I'd like to reduce the amount of files and folders, since they're now over 17k and 5.4k respectively.
Is there a way I could flag unused files for deletion?
Perhaps while navigating the site, e.g. whitelisting files that are being used?
Any help would be greatly appreciated!
I think sometimes its quicker to write things from scratch rather than work with "Megamoth" but if you need to keep it running you probably need to put it into some kind of version control system.
I recommend Git
http://en.wikipedia.org/wiki/Git_%28software%29
https://git-scm.com/
and just start refractoring it.
Version control system will keep your old code so you will be sure that you don't loose anything while deleting or changing your code and you will be able to jump from one version to another very quickly.

Why is Node Express Duplicating Static Content

I have the following app.js file:
https://gist.github.com/manifestinteractive/393a4aae0c4ed4fb6bc2
When I look at files I am loading statically in the public folder via the operating system, they look correct, however, if I go to view them via the browser as intended for delivery through node express engine, the contents are duplicated. Basically, it is taking the file and appending it to itself, which of course breaks the javascript.
Anyone know why this would be happening? Suck a weird bug and I can't for the life of me put my finger on the cause.
For the record, I have tried looking everywhere for a solution. I've just not seen anyone talk about it. A quick test shows that I can manually change the JavaScript file at the source, and refresh the code in the browser, and it will reflect the changes correctly, but it will still be displayed twice.
Thought it might be some weird issue where maybe I had multiple instances of Node running or something, as that MIGHT explain it... but nothing :(
If I find what it is, I will follow up with the issue immediately, but for the time being, I am likely just doing something stupid someone here might yell at me for... and I would gladly welcome it :)

Modernizr.load and performance (cache) for conditionally loaded async resources

I read about a dozen posts on here, this one seemed closest but didn't quite clear it up for me.
I am building on HTML5 Boilerplate, albeit a custom Modernizr build. I am planning on using the yepnope/modernizr.load functionality for conditional loading.
The .htaccess in H5BP removes Etags and adds expires headers (I guess expires headers are required for Modernizr.load). It also set expirations of "access plus X"
How does this work in relation making the most of cache to 'speed up' the browsing experience. Will every resource who's conditions are met load on every page or will things which are cached be skipped?
What if just one of the components (one of the resources I am loading) is changed yet my version of Modernizr isn't?
After posting I realized this may more suited for the webmasters forum (there's no actual code in the question...) but I guess I am unsure if there will be an answer that involves code so for now, I'll leave it realizing perhaps it should be migrated. Sorry, this level of coding and configuration is new to me.
Thanks
Each resources is cached independently. So, if you load a javascript file named foo.js, this file will be cached for one year: https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess#L245
If you change your modernizr script to a new version, this won't change the cache end date of foo.js which will remain untouched.
In order to bust the cache, you'll need to change the file name (e.g.: foo-v1234123.js), the path or you could add a query string (foo.js?v=1). If you make change to foo.js then just increase this version number by one to force the browser to redownload the file and recache it.
If you're working on a simple website and no big project, using a query string a doing this manually may be the easier solution. Or else, I'd suggest to hooks versions number via git or something similar - but this would need to be automated for your sanity.
Hope this help !

breakpoints in single-lined js-scripts with firebug

i want to analyze an external js-file. but the file is single-lined and obfuscated. so i cannot set meaningful breakpoints. (though automatical unobfuscation, code-indentation is assumed to be possible).
first of all, what would your suggestion be to overcome that impairement?
i wonder if it is possible to replace an external js-file with an unobfuscated nice-looking (maybe altered one) and have this one executed instead. any ideas?
i found a way. i am not accepting my answer as the answer b/c its not as comfortable as i would like it to be. so i am interested in further ideas.
you install foxyproxy and configure a new proxy for '*filename.js' (mind the asterisk!). as you host you use a local server, so '192.168.?.?' or 'localhost'.
thing is if the URL of the js-file to be replaced is 'http://www.abc.net/dir1/dir2/filename.js' then you have to make your new js-file accessible at 'http://[host]/dir1/dir2/filename.js'.
that setup is somewhat complicated. it should be possible to have the js-file replaced by another file anywhere on your disk. but it does the job.
Take some tool which has reformat code option. JetBrains WebStorm for example. It should break the lines so they will be suitable for setting breakpoints.
This should take 5-10 minutes. I doubt you will be able to do anything more without spending much time.

Categories

Resources