scss & coffeescript not compiled in sinatra in production deployment - deployment

I am new to Sinatra, so maybe this is something silly.
I just made a simple site, so I think this is the time to try sinatra out. And I also included coffeescript and scss according to the Sinatra document, that I have the following code in my sinatra app:
#Needed for Coffeescript and SCSS
get '/js/:script.js' do |script|
coffee :"coffee/#{script}"
end
get '/css/:stylesheet.css' do |stylesheet|
scss :"scss/#{stylesheet}"
end
it works quite well in development, but after I delopy it to my staging enviroment(nginx+passenger). The request to application.js and application.css all return with 404. It looks like that they didn't get compiled by coffee and scss
What should I do?

Related

Can someone explain how SystemJS works?

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?

MeteorJS, coffeescript files not loaded on the clientside

I'm trying to use coffeescript for my client-side code in Meteor, but it doesn't seem to work..
I've created client/views/welcome/index.coffee with the following content:
console.log 'this is welcome index'
But the console isn't logging anything and I don't see the file being loaded at the client.
Run the following command to add the coffeescript package to Meteor, which will enable the transpiling of coffeescript source:
meteor add coffeescript
Otherwise, coffeescript files will be silently ignored (there was a suggestion to improve this behavior). For now, you can make sure the package is added by checking for it in .meteor/packages.

How to compile Coffeescript in visual studio 2013 express?

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.

meteor minified with production flag fails to load certain files

I am not getting any errors from the server or the browser console but my application seems to break when i minify or use the --production flag. I have went back to a revision/changeset that i recall working with meteor deploy and it still fails. Has anyone else faced this problem ?
I should mention, i just ran this with an older version of meteor and it works. Meteor version 0.7.0.1 looks like might be the problem?
EDIT: Running 0.6.6.3
I ran meteor --release 0.6.6.3 --production to minify and use an older version of meteor. This works perfectly, any one know if the bundling process has changed in the latest version of meteor ?
Way back with v0.6.4.1 we had issues if we had #media statements split across multiple files. Putting them all in one file avoided the css minification problems. May work for your #import statements as well.
-- update --
"I looked back at all my #import statements and found one that was commented out and saw that in production my css file had been corrupted." #Warz in comments
So it looks like commenting out #import statements is not supported in the css minifier as of Meteor v0.7.0.1.
Something went wrong while minified javascript files. I temporarily deploy without minifying to avoid this kind of problems:
meteor deploy --debug yoursite.meteor.com

Using coffeescript with basic Yeoman project.

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