CodeKit
CodeKit copied to clipboard
CK Seemingly messing with a file I don't want it to!
Quick, short summary: I am including the DOMtastic library to bootstrap my js components and I think CodeKit is altering the code of DOMtastic when all I want CK to do is concatenate. This one may be a little tricky to explain but if i pull DOMtastic out into its own script tag it works as it should. It is my very first CK prepend rule so should work a treat
Expected results: DOMtastic to work just like it would in its own script file.
Actual results:

Exact steps to reproduce:
Create a new project with an index and a script file, in the script file write a CK prepend rule for DOMtastic, set that file to not process or minify or transpile or anything (not sure if this is all needed) Then go to your script.js and set that to transpile and minify, check that DOMtastic is included and that the shield is unticked. Compile and test with this line at the end of your script.js $('body').addClass('success');
A link to download a simplified project or file that shows the issue: site.zip
Your configuration (any details about your system that you think might be relevant)
Babel is turning all top level this to undefined.
To prevent this: babel --blacklist strict the-script-thats-not-a-module.js
Source: https://github.com/babel/babel.github.io/blob/862b43db93e48762671267034a50c30c00e433e2/docs/faq.md#why-is-this-being-remapped-to-undefined
Sorry @subhaze where do I put this?
Oh sorry, that was more of a note for @bdkjones. Only way you could do this would be bypassing CK's config completely.
Ah I see, I'll hold fire until @bdkjones can take a look, essentially if i can tell CK to just plain ignore an include and simply concat the code but not process or minify or transpile, that would be ideal especially in cases where I'm bootstrapping my code with polyfills or micro libraries.
Thanks!
Select your base JS file (the one that prepends the others) and turn off transpiling for that file. It will affect the entire chain.
Ah ha! So i'm thinking about it the wrong way round, no transpiling, minifying on the main file but set the rules per include. I shall try it now good sir
mmm, close. The rules for the BASE file apply to the entire chain.
So upon playing I can see that I don't have an option but to apply transpiling and minification to the base/main js file. The only way I can see this working is to create an arbitrary js file, for the sole purpose of including files that need transpiling. Then have another file which concatenates my bootstrap (in this case DOMtastic) and the base/main js file that does not transpile. Is this the case?
or i suppose i could create processed versions of every module and include those as an alternative
Does Babel not have inline comments that can make it skip transpiling? If it does, the ideal solution would be to wrap your prepend statement in those comments.
Just looking now..
I don't think it does, this is an older ticket, but any newer ones with similar requests pointed back to it https://github.com/babel/babel/issues/670
Lame, theres not a way I can do this currently in CK. I can see why it works the way it does however it would make a world of difference to have a more granular control over the way CK concats files. Even if the solution is to set the process config on each file rather than the main. That would be fine.
Sorry @bdkjones i'm reopening as there is no way around this in CK my only option is to revert to a task runner and do all this jazz in terminal which I loathe, deeply.
Hi everyone
Has anyone found a solution to this? I would love to be able to take advantage of transpiling my code in babel while leaving the imports untouched and still included.
Is there a work around for this without involving webpack or browserify? Maybe some setting somewhere to tell codekit which imports or files in the chain not to run through babel?
Thanks!! :)
Yes. I have. It will be in the next update.
Sent from my iPhone
On Dec 20, 2016, at 10:50, HB Woodrose [email protected] wrote:
Hi everyone
Has anyone found a solution to this? I would love to be able to take advantage of transpiling my code in babel while leaving the imports untouched and still included.
Is there a work around for this without involving webpack or browserify?
Thanks!! :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
man, you are so goddamned awesome. i dont understand how you do all of this, but i am eternally grateful :)
Whiskey, mostly.
Sent from my iPhone
On Dec 20, 2016, at 11:27, HB Woodrose [email protected] wrote:
man, you are so goddamned awesome. i dont understand how you do all of this, but i am eternally grateful :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.