Can I use Sass in my production environment with Ruby only installed on my development environment? - ruby

Sass needs Ruby to work. I can install Ruby in my development environment. Nonetheless, I cannot do it in some production environments (hostings).
The reason I think it might work is because the .css files are created every time I run the sass command in my local environment, so once I deploy (push) my website to my server, it has all the .css files already transcribed.
Am I wrong? Do I still need to run the sass command in my server?

You are right. Once the SCSS files are compiled into CSS, you dont need ruby anymore and can use the CSS files as is.

Related

CSS file not found when pushing a Jekyll project to gh-pages remote branch and using jekyll-compass

I was building my site with css and everything was working fine, both locally and remotely. Then I wanted to switch to sass. I installed jekyll-compass and now my sass files are being output as css files in my _site/css folder. Everything works well locally, but when I push them to Github, my styles are not being applied and I get a 404 on that css file. What am I doing wrong?
Instead of setting the output of your rendered SASS files to /_site/css, set the output to just /css (the site root level).
What is happening is that locally SASS is running just fine and outputting into your /_site/ directory as you'd expect. But in production on GitHub pages (where the jekyll-compass gem isn't supported) your CSS isn't being output into /_site at all because the plugin isn't being executed there.
It doesn't matter that it works locally from there because GitHub Pages runs the jekyll build command again once you push and generates /_site/ afresh. So anything it doesn't support (i.e. jekyll-compass) doesn't make it into the production version of your /_site folder.
The workaround I've suggested works because instead of outputting the final CSS into a directory that gets overwritten when you push to GitHub pages, it will instead write it to a directory that is preserved even with a fresh build of the /_site/ directory.
Also of note, Jekyll 2.0 will support SASS, and you can even use the 2.0 alpha gem locally if you want (although GH Pages won't be updated to 2.0 until it's officially released).
Very few plugins are supported by GitHub pages, it used to be none but now there are three. See this page for more information.
You will need to compile the SASS and commit the generated CSS files.

Setting up SASS with jekyll?

I've been trying to setup SASS (and Bourbon.io) with jekyll for a personal blog on github pages.
I've changed the name of the css folder that is installed with jekyll to stylesheets and within stylesheets I have two folders, css and sass.
I start my jekyll server locally with: jekyll serve --watch
Then in another terminal window: sass --watch stylesheets/sass:stylesheets/css
But I am now getting the following message:
`/' not found.
Prior to attempting to setup SASS with my jekyll project, my site was displaying. Any links for setting up sass with jekyll would be helpful. Thanks.
New in Jekyll 2.0 is native processing of Sass and CoffeeScript:
http://jekyllrb.com/docs/assets/#sassscss
hope not being to late, for what you are pretending there are many approaches for example i use bourbon, neat in a jekyll project and use grunt tasks for local development.
Another option is to use a rakefile with some task to handle both programs (jekyll and sass) or as favrizio suggested use jekyll's pluging.
I reccomend you to take a look to grunt.
This happens usually if you have messed with the site baseurl in the _config.xml and it can no longer resolve itself to find the index.html.

Installing the correct environment for Angular with Compass and all other Node dependencies

I am just trying to make a local development environment that isn't on my work computer, and I keep getting an error:
Warning: Errno::ENOENT on line 441 of /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb: No such file or directory - /Users/johnpett/Desktop/Node/app/bower_components
Run with --trace to see the full backtrace Use --force to continue.
I have installed all the Ruby parts and Yeoman to build the app scaffold, but I can't seem to run the 'grunt server' command without throwing up this error.
The error is quite clear, a grunt-plugin require that file...
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb
Anyway ruby components are needed usually if you plan to use compass, if not, you can comment the "compass" sub-task in the "server" task in Gruntfile.js
Your folder was surely not called bower_components at that time. I guess you used yeoman.
In your compass task config you should have modified bower_components.

Using compass with Yeoman project, but outside of Yeoman server

I'm circumventing the built-in Yeoman server and severing files directly from the /app directory. Since Yeomen's server manages compass/sass compliation I'm having a hard time running compass outside of it. Running the compass cli directly doesn't work; it's not aware that it's in an existing compass project. So I get:
$ compass watch /app (or /app/styles)
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Has anybody had experience getting this to work?
You have to move your Compass settings out into a config.rb file to use the Compass CLI.
However, you can easily run the Compass grunt task individually like so grunt compass to compile, or grunt watch to automagically compile on file changes.

How can I run SASS without installing?

I wanted to use SASS on our company's web app but I can't install any programs on production machines. Everything I searched about SASS required you to run an installation program like gem and also required HAML.
I was hoping to find just a script that processes scss files without needing to install anything else.
Well... if you have Ruby available, you could checkout the Git repository of Sass (https://github.com/nex3/sass). Do so by either typing git clone https://github.com/nex3/sass.git or just downloading it.
Then you could use the interactive Ruby console by typing irb. Try to require 'sass/lib/sass' (this one here) and run Sass.compile_file 'my_styles.css'.
Otherwise... why are you trying to do that? You can also install sass locally, run sass --watch on your sass folder and it compiles your scss files automatically into css files - which you can deploy on your production environment.
If you can run java program in your build system, you could use JRuby for compiling sass. See this answer for more details
Here's a solution for using Sass without using the command line or installing dependencies. It works with Windows, OS X, and Linux. It has a graphical interface, and no installer, just unzip and double-click.
http://scout-app.io
You can also use the java library https://github.com/scireum/server-sass which can be embedded into any java based web-app. It will compile sass on the fly and return the resulting css. This is especially useful if the Sass sources change (i.e. for customizing reasons) and an ahead of time compilation is not possible. (Note: I'm the author of the project - and it is also not yet a complete implementation of the Sass standard).
Alternatively, what you could do is:
Install Ruby
Download the Sass Gem
Navigate to download location
Run: gem install sass-3.3.4.gem
Voila! Sass is installed.
Use the online Sass compiler SassMeister. You just have to paste your sass code on the left panel and get the css code on the right.

Resources