I just want to know how SystemJS works. My idea is that it executes modules transpiled for it, but I really don't know how it gets a System.import-ed module executed.
For instance, I have my Angular2 app transpiled with Gulp and Typescript to a bundle and load it via SystemJS. The app is loaded perfectly: I get no console errors in my browser, but the application doesn't start.
Do I need special prerequisites for transpiling and running Typescript code?
Related
Has anyone been successful in adding material-components-web into snowpack project?
I have used #snowpack/plugin-sass", it work fine with local .scss files, but when trying to import MDC components with javascript for example (import {MDCRipple} from '#material/ripple'; ), it breaks the sass modules of mdc in node-modules and always gives error like 'dependency not found'.
Also used saas-migrator package and it didn't work with them either.
It seems like a sass version failure, but don't know what is problem because all the examples are based on webpacks.
Could anyone share proper snowpack+#snowpack/plugin-sass+material-components-web configuration with simple example?
I followed this,
Go download and install VS Web Essentials
Add a new Item to your project, pick CoffeeScript as the item type
Write your CoffeeScript code, when you build the project or Solution, it will create the JavaScript code.
But, it does not create any compiled JS file.
How can I compile coffeescript? Do I need to install node.js?
I haven't tried Web Essentials for VS yet because it's easier for me to just include the coffee-script.js file using a script tag and compile it using the browser. I also console.log the compiled JavaScript output to the browser to see what it is generating. Here are a few examples using this technique:
https://github.com/jabdal/coffee-script-examples
Remarkably, it will sometimes find errors in the resultant JavaScript and go to the line with the error.
I'm guessing you could then send the JS back to the server and save that to a JS file (along with a checksum of the original coffeescript file). Then instead of compiling next time, you could include the JS file that is on the server if it is the same version (compare checksum before compiling on client).
I've read somewhere there is a .NET implementation of JavaScript that might work with the coffeescript compiler so that you could compile on the server without having to use Node but I don't think it would hurt to offload it on the client. A nice way would be a runat="server" tag for script type="text/coffeescript" tag so that the server would replace the coffeescript tags with javascript tags along with the compiled code and also generate corresponding js files where there are coffee files.
I'm keen to use coffeescript within Trigger.io and to do so I am following the details as described at http://docs.trigger.io/en/latest/tools/hooks.html
I've placed my coffeescript.js file in the hooks/prebuild directory as required but the build now fails. I've commented out everything in the coffeescript.js file to ensure it's not the file's contents.
It detects the coffeescript.js file in the prebuild directory as shown in the log output but then it can't find some file. Anyone else have this problem? I'm using version 1.4 of the Trigger Toolkit.
[INFO] Running (node) hook: coffeescript.js
[DEBUG] Running: 'node' '/Users/Will/forge-workspace/alpha-timing/hooks/prebuild/coffeescript.js' 'ios'
[ERROR] [Errno 2] No such file or directory
A slight tangent... but you might want to have a look at Brunch.io
I've recently started using it for building the JS for my trigger.io app and it works great. It can compile your coffeescript, js, css and more automatically. Comes with a watcher and auto-reload, so when you are developing and testing in browser it's very fast.
We use Node.js to transform the coffeescript into JS at the prebuild stage - it looks like you don't have it installed: go to http://nodejs.org/ to grab it.
Note you'll also need coffee-script to run that hook!
I've used Yeoman to make a quick project skeleton using the yo webapp generator command. In the resulting Gruntfile I see that it's setup to compile CoffeeScript but it seems like its just sticking compiled files in a tmp folder.
coffee: {
dist: {
files: {
'.tmp/scripts/coffee.js': '<%= yeoman.app %>/scripts/*.coffee'
}
},
},
How do these get included in the project during development. I'm not using RequireJS.
The yeoman docs are unclear on how to use coffeescript. They only mention that it gets automatically compiled.
Using yeomen 1.0.0-rc1.4. I use:
$ yo angular --coffee
The resulting project has controller and app scripts in CoffeeScript.
grunt configuration file remains in js (what is not really a problem).
Running
$ grunt test
runs tests and all seems fine.
$ grunt server
is also doing what one expects (build the app, test it, starts server, opens the app in web browser and starts watching for changes, so if I change a coffee script file, it is quickly reflected in the web broser.
Documentation also states, one can use yo to add particular pieces like
angular:controller
angular:directive
angular:filter
angular:route
angular:service
angular:decorator
angular:view
each can be called with a --coffee switch and get the script in CoffeeScript, e.g.:
yo angular:controller user --coffee
I just found an issue in the github repo referencing this problem. https://github.com/yeoman/generator-webapp/issues/12
It offers a temporary solution: https://github.com/yeoman/generator-webapp/issues/12#issuecomment-13731929
I've just picked up CoffeeScript and I'm struggling to understand the deployment workflow. It seems you constantly have to compile the .coffee files before using them. (Yes, I'm aware that you can have it embedded in the browser, but that's not recommended for production applications).
Does one have to constantly (manually) compile the files before deploying? (For example, if using Eclipse, a simple Ctrl+S saves and deploys the .war/.ear on the local machine's server.) Do we have to change the build scripts (for a central, possible CI server) for deploying .coffee files? Is there anyway to have integrated compiling via the IDEs (Eclipse/Netbeans)
Any ideas/pointers/examples on this? How/what have you used in the past?
I call browserify in my Cakefile to pre-compile and package my CoffeeScript for the browser. For an example of how I call browserify as well as coffeedoc and coffeedoctest take a look at the Cakefile for my Lumenize project.
If you are using express or some other node based server, you can have your CoffeeScript compiled at request time, using tools like NibJS or as described in The Little Book on CoffeeScript (Applications chapter), you can use Stitch. BTW, I highly recommend, The Little Book. The "Compiling" chapter has information about Cake and compiling that might help you.
Yes, you should have a build script. Most CoffeeScript projects use a Cakefile for this; see, for example, 37signals' pow. With a Cakefile, you can just run
cake build
from the command line to run the build task in the Cakefile.
You can run the Cakefile on a CI server, assuming that you have Node and CoffeeScript installed on that server.
Don't deploy the coffee files, use something like "coffee -cwj" to constantly watch and compile the .coffee files into javascript (.js) files and deploy those.
The options are c=compile, w=watch and j=join the files.
See the coffee-script web site for details of the options you can pass in.