Go: precompile SASS and SLIM files into Go HTML format - go

I'd like to use SASS and SLIM for my Go project. I'd like the html files to be rendered server side.
I know there is https://github.com/shaoshing/train, but it seems like rendering occurs on the client side, which is not what I want.
There is also https://github.com/yosssi/ace, which is a native implementation of SLIM in Go. However, there is no SASS implementation.
Does anyone have any idea on how to do this?

Related

CDN Converter - Scss to Css

i wonder if there is some CDN converter, which will convert my scss to css. I need to write some simple mockup project (SASS is required here) and don't want to prepare gulp or webpack for it. Also i have to avoide all websites like codepen etc.
Do you know something like this? Maybe there is something else, what will allow me using SASS files direct in my project.
Cheers,
Daniel
What do you need is an Online Converter, if I correctly understood.
Take a look at sites like Sassmeister or online SCSS or SASS compilers.
If you don't want to depend in your connection, you can do this if you have ruby installed.
gem install sass
sass --update scss:css
Then your SCSS will be compiled CSS

How to compress assets without Rails or Sprockets?

I'm writing a Sinatra app and I'm quite tired of Sprockets (because it's hard to configure and doesn't support some libs). I'm thinking of moving to Compass for stylesheet management but I haven't found anything similar to it when it comes to scripts. Now I can manually compile coffeescript into Javascript and concatenate the resulting files, but how do I compress them for less size? Thank you very much.
You may take a look at Gulp. Here is the good article about using Gulp with Rails (but it would work for Sinatra too).

How to automatically compile scss into css with assets pipeline in Rails 3.1?

The new rails 3.1 asset pipeline confused me a lot. In rails 3.0.x, with the sass gem, my global css file got updated when I edit .scss files. But in rails 3.1, that doesn't work anymore. It seems like I have to run a rake task to update my css files whenever I modify the .scss files. I feel like I misunderstand something about the new asset pipeline, but I don't know what it is. Can someone provide a solution or explanation to this problem? Thank you.
There are two possible causes of this. I am assuming that you are in development mode, and that all the gems are loaded.
1. Config
In development mode files are compiled on-demand and cached until any changes are made. You have to get the new 3.1 config options set in the right files or this might not work as expected.
Check out the Rails guides section on upgrading.
2. Extensions
The other is getting the extensions in the right order. For scss that would be file.css.scss. This tells Sprockets to parse the files as scss first, and that the have a css extension. If you had .erb on the end - file.css.scss.erb - then erb is processed first, then scss.
Upgrading apps is a bit tricky because so many things have changed. The asset pipeline guide has lots of useful information and advice.
Sass / SCSS has this built in already so you don't have to do ERB pre-processing.
image-url("image.png")
http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets
For me this problem resolved very easy.
I simple deleted all precompiled *.css files from assets/stylesheets and remain all *.scss files. Rails worked fine with *.scss directly, withoutn precompile.

Simple Compass+HAML webserver

I love compass (SASS) and HAML. I've been using staticmatic for building static web pages. Staticmatic seams outdated (no updates, bugs). What are the alternatives?
What I would like:
$ preview .
> Server started ad port XXXX
> Now you can use Compass and HAML
:). So... no configuratio, no directory structure, just haml and sass files.
I am currently using Compass/Sass/Haml with middleman. https://github.com/tdreyno/middleman It is very easy to use, and runs a sinatra in the background so you can see your changes live in your web browser.
After you are done editing and previewing your markup it builds static HTML from your stack of Compass/Sass/Haml. See https://github.com/tdreyno/middleman/wiki for usage.
This requires no conf at all except to tell it which templating engines you are using at setup so I think it is exactly what you are looking for.
You can try jekyll. I think it doesn't work with sass and haml out of the box but you can look at plugins
Don't forget Nanoc. While it is a little involved, it has some slightly more powerful features than StaticMatic. It does depend on a directory however. :/
There are just a ton of static generators around, most of them in Ruby. I'm planning to use Frank for the next few static projects.
It uses Tilt to support a ton of template engines
It has a concept of layouts, which go in a separate layouts folder, and templates can have a metadata header, but other than that it's very minimal.

Fastest and most efficient way of converting **haml** and **scss** files? (Ruby on Windows)

I'm a ruby/haml/sass-beginner. I just installed ruby and rails for windows, haml, and sass (stand alone and plugin for rails).
I know how to convert and haml file into a html file (and vice versa):
haml index.haml > output.html
and how to convert a scss fiel into a css file (and vice versa):
sass --watch style.scss:style.css
I save more time converting scss files because every time I save a scss file the corresponding css file is automatically updated (i think that's the suppose of the watch command)
but for the haml files, I'm still doing it manually (haml index.haml > output.html).
I believe there's other ways to save time converting haml and scss files.
Any suggestions?
When you setup Rails to work with Haml, then start your development server, the Haml in your views get converted into HTML for you on-the-fly, so there's no need to watch for changes to your Haml separately.
However, if you're creating prototypes using just Haml and SCSS and not using the Rails stack at this stage, then there are a couple of useful tools you can use that automatically render your Haml and SCSS on page refresh:
Serve
http://github.com/jlong/serve
StaticMatic
http://github.com/staticmatic/staticmatic
Of these two, Serve is easier to use, but is not as powerful as StaticMatic. With Serve, all you need to do is install it (gem install serve) and type serve at the command line in the directory containing your Haml files. Then point your browser at http://localhost:4000. Full details here.
You can also hook-up Serve to make use of Compass the Sass meta-framework (which is awesome). There's a full tutorial here.
Oh, there's also dynamicmatic now too which might be good as well to look into. Basically similar to staticmatic but with some obvious differences that might be useful. I've used SM quite a lot recently and really like it. Very easy to use, very simple to set up and really does most things I need it to.

Resources