Using compass with Yeoman project, but outside of Yeoman server - compass-sass

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.

Related

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

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.

listener.rb: Not a directory

In the past few week, I've started seeing errors when I try to run compass watch:
Errno::ENOTDIR on line ["60"] of /Library/Ruby/Gems/2.0.0/gems/listen-2.8.0/lib/listen/listener.rb: Not a directory - /Users/nick/.compass/extensions/readme.txt/stylesheets
It will watch and compile the SCSS into CSS once and then I have to run compass watch again and get that error. When I run compass watch --trace, I get this:
https://www.dropbox.com/s/s1cia842dusitol/compass-watch-trace.png?dl=0
My versions are Compass 1.0.1 (Polaris) & Sass 3.4.9 (Selective Steve)
I had the same problem when running compass watch in terminal because I was in the wrong directory. Are you running it in the same directory as the config.rb file is located at?
I fixed it by first navigating to the folder config.rb is in and then executing compass watch...
Best option I found was this: Failed to build gem native extension (installing Compass)
After that, I starting using http://mhs.github.io/scout-app/ and that worked fine. When I started a new job that uses Grunt, I ditched compass watch all together and used the grunt-contrib-sass plug-in to get the job done.

Compass - Changing default of "compass watch"

With SASS you are required to create a config.rb which manages the location of the app. I've recently changed the name of this file to "sass_config.rb" and can't figure out how to change the default of "compass watch" so that it finds my renamed file.
To clarify, when I run the following command compass correctly finds the file and continues with its normal behavior:
compass -c watch sass_config.rb
But when I run:
compass watch
It says:
Nothing to compile. If you're trying to start a new project,
you have left off the directory argument.
How can I fix this behavior so it sees the file has been renamed by just running "compass watch"?
The configuration filename cannot be arbitrarily modified. It is hard coded within Compass to be in one of 5 locations (soon to be 4).
https://github.com/chriseppstein/compass/blob/192107cb4f17bef52fdd8c0d961fe77f3edb44c4/lib/compass/configuration/helpers.rb#L137
# TODO: Deprecate the src/config.rb location.
KNOWN_CONFIG_LOCATIONS = ['config/compass.rb', ".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"]
Just create a compass project by
compass create
after that you copy the OLD config.rb content to the created one from copass.
Now try
compass watch

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.

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