Is there a way to trigger an error in Stylus when missing a variable? - gulp

I recently migrated from Sass to Stylus, and I'm loving it.
However, there is 1 thing that really made sense in Sass that doesn't exist in stylus. The compiler should yell at me if a variable is undefined, instead of just spitting it out as a string like nothing ever happened.
Is there a way to make the compiler yell at me ?

Assuming all options are in this page, you cannot do what you want at the moment.
You can still add this feature yourself or request it (by creating an issue) on the official github repo
By the way, this would be a good feature.

Related

What's this strange syntax in AS3. Why does this make my browser hang//crash silently

I've stumbled over this in AS3.
while(y.t<ys) y.(y.t++, 0);
And I'm wondering, what's this strange dot parentheses syntax .() ? What is it supposed to do ?
Moreover i've tried a snippet of code including this in a browser and this make Flash hang//crash silently.
Any idea why ?
Thanks you
edit: The original code is there as3-crypto
ps: I would infer it's some kind of dot notation followed by comma operator but i can't be sure at this point.
So, I investigated that thing a bit. First, I located the mentioned as3crypto repo and checked that the given code line is, indeed, there. The line there was not documented in any way and still makes no actual sense in AS3 terms.
Second, I viewed the deployed SWC library with decompiler, and, yet again, exactly that one place makes no sense and comes out malformed, which might be the sign that library was initially composed not in AS3 but maybe in HAXE.
Finally, I moved to the repo issues section seeking for the way to inquire the owner about that line, but then I have just noticed that such an issue is already open: https://github.com/timkurvers/as3-crypto/issues/14
So, the conclusion remains the same as I initially announced: it is not any valid AS3 syntax and probably just an error (maybe a translation mistake) in the repo.

NativeScript, Code Sharing and different environments

Note: this is not a dupe of this or this other question. Read on: this question is specific to the Code-Sharing template.
I am doing some pretty basic experiments with NativeScript, Angular and the code sharing templates (see: #nativescript/schematics).
Now I am doing some exploration / poc work on how different "build configuration" are supported by the framework. To be clear, I am searching for a simple -and hopefully official- way to have the application use a different version of a specific file (let's call it configuration.ts) based on the current platform (web/ios/android) and environment (development/production/staging?).
Doing the first part is obviously trivial - after all that is the prime purpose of the code sharing schematics. So, different versions of the same file are identified by different extensions. This page explain things pretty simply.
What I don't get as easily is if the framework/template supports any similar convention-based rule that can be used to switch between debug/release (or even better development/staging/production) versions of a file. Think for example of a config.ts file that contains different parameters based on the environment.
I have done some research in the topic, but I was unable to find a conclusive answer:
the old and now retired documentation for the appbuilder platform mentions a (.debug. and .release.) naming convention for files. I don't think this work anymore.
other sources mention passing parameters during the call to tns build / tns run and then fetching them via webpack env variable... See here. This may work, but seems oddly convoluted
third option that gets mentioned is to use hooks to customize the build (or use a plugin that should do the same)
lastly, for some odd reason, the #nativescript/schematics seems to generate a default project that contains two files called environment.ts and environment.prod.ts. I suspect those only work for the web version of the project (read: ng serve) - I wasn't able to get the mobile compiler to recognize files that end with debug.ts, prod.ts or release.ts
While it may be possible that what I am trying to do isn't just supported (yet?), the general confusion an dissenting opinions on the matter make me think I may be missing something.. somewhere.
In case this IS somehow supported, I also wonder how it may integrate with the NativeScript Sidekick app that is often suggested as a tool to ease the build/run process of NativeScript applications (there is no way to specify additional parameters for the tns commands that the Sidekick automates, the only options available are switching between debug/release mode), but this is probably better to be left for another question.
Environment files are not yet supported, passing environment variables from build command could be the viable solution for now.
But of course, you may write your own schematics if you like immediate support for environment files.
I did not look into sharing environment files between web and mobile yet - I do like Manoj's suggestion regarding modifying the schematics, but I'll have to cross that bridge when I get there I guess. I might have an answer to your second question regarding Sidekick. The latest version does support "Webpack" build option which seems to pass the --bundle parameter to tns. The caveat is that this option seems to be more sensitive to typescript errors, even relatively benign ones, so you have to be careful and make sure to fix them all prior to building. In my case I had to lock the version of #types/jasmine in package.json to "2.8.6" in order to avoid some incompatibility between that and the version of typescript that Sidekick's cloud solution is using. Another hint is to check "Clean Build" after npm dependency changes are made. Good luck!

Minify ceylon-sdk and ceylon-language when compiling to javascript

For an in-browser application written in ceylon-js it would be desirable to reduce the size of the ceylon.language-1.2.0.js file to only that what is actually needed.
This question was answered already.
How to use ceylon js (also with google closure compiler)
But the given solution involves manually editing javascript code resulting from compilation. This is not desirable since a compiler should produce code that hasnĀ“t to be edited manually after compilation (abstraction).
And it is not clear to me if google closure compiler can cope with the ceylon flavour of it in a reliable way.
Is it instead a solution to copy ceylon.language source in ceylon into the project and import only those parts of ceylon.language into the project that are required by it? Then compile to javascript. And then leave away ceylon.language-1.2.0.js at all from the client / in-browser application.
Now my questions:
What parts are needed in the most simple browser application? I think of something like Array(String) and the like.
Has that solution a chance to work absolutely reliable?
Will there be a better solution coming from the authors of ceylon that make this attempt obsolete?
The compilation of the language module to JS is a tricky process, because of the native stuff involved and because there are a couple of declarations that have to be in a certain order for things to work.
Minification is still pending, we are going to do it but it's not the highest priority right now, and we have to determine the best way to solve this problem; one option that has been discussed is to have a version of the language module without any metamodel info, for example.

Array of css files being requested

Is there anyway to get an array of stylesheet being requested by the site. Like in module stage of loading.
The point is that i am making application cache for drupal site, and (captain obvious) i need css files also to be downloaded.
Drupal add's hahs(?) automaticly to some css and js files and i dont even know how, and i dont know how to turn it off, and there are over 15 css files. i could aggregate them, but still i am not able to get file name into variable or db.
Any good suggestions?
After a while of research, i managed to go look from api, and yea, there was drupal_get_css hook, that helped a lot. Then there was another problem. Dummy string, You know the ?=aslkd thing after filename. I strugeled sometime with it, and then i decided to turn it off. Now kid's, never do that! NEVER! I lost alot of my styles and things got broken.
I got desperate, and went to dig in to advgg's module and searched what i can find from there.
I got both js and css file from that module. Just go and find advagg_merge_plans and then
try this dpm($css_js_groups['0']['filepath']); with devel module, and wait for the magig!
Hope i saved some one's day of googling

How to compile the generated AS

hope you can help me with this question.
So, I've been working for a while with Flex, and had the crazy idea to create pure AS project.
If I compile a Flex app with the -keep flag, the generated actionscript gets generated.
Do you guys know of a way to make it compile, without going trough the code and gluing it all together?
Thanks.
Generated ActionScript is really only provided for reference; it's not really intended to be repurposed in that sense. Indeed, if you even have any, you've most likely compiled your project already anyway (unless you got it from somewhere else), so one might ask why you'd want to compile the generated stuff rather than your own source -- but nonetheless, although I haven't actually tried it, you should be able to point the Flex compiler mxmlc at your generated source to compile it, provided you're able to get all your dependencies to line up (which may be what you mean by "gluing it all together").
Just a thought, although again, I haven't actually tried it, so your results may vary. What is it you're trying to do, though? Just curious. :)
Like Christian mentioned, the generated AS code is pretty much there to serve as a reference. Just for fun, I tried compiling it from the command line using mxmlc, but part of the problem with doing that is that the class files generated don't match the classes they represent. So, you'd need to start renaming a bunch of your class files so that compiling those could even work. Many of the other classes in Flex won't be compiled in either, for the same reason.
As an example, the project I tested this with, had only one mxml file of source code in it. The generated output was 45 files. I'm sure that if you really wanted to do this, and were willing to invest the time in cleaning things up you could. But I'm curious too - why would you want to do this?
Actually it was just mere curiosity. I wanted to understand how the framework works and see how it merges it all together to make the final application, as I thought that the generated actionscript files were just a step in between the final SWF file, so I tought there should be a way for it to grab those files and generate the final application.
Eventually I would have tried to create a pure actionscript project just for the heck of it to see how complicated it was and what errors could happen when developing other stuff.
I know it sounds crazy, but I had some spare time, ha ha ha.