Compass + Dropbox = File to import not found or unreadable - sass

I've got a funny error.
My sass files are located on a Dropbox folder. I edit them locally on my dev pc, and then they're synced via Dropbox to the server. On the server I have a CentOS installed with CLI Dropbox service.
I have an app.scss file and a _settings.scss file included from app.scss. If I edit _settings.scss, the following error is thrown:
error app.scss (Line 2: File to import not found or unreadable: settings.
Load paths:
/www/psmb.dev/web/typo3conf/ext/speciality/Resources/Public/foundation/sass
/usr/local/lib/ruby/gems/1.9.1/gems/compass-0.12.2/frameworks/blueprint/stylesheets
/usr/local/lib/ruby/gems/1.9.1/gems/compass-0.12.2/frameworks/compass/stylesheets
/usr/local/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.1/scss
Compass::SpriteImporter)
If I then change something in app.scss, it's compiled without error.
Now the funny thing: if I edit _settings.scss locally on the server, or via ssh, then no error is thrown!
What's up?

After some suggestion and Dmitri's test verification, we came to the conclusion that most likely compass watch caught the file change "too early" while dropbox process is in the midst of making complete sync of the file. The file sync is probably implemented by 2 or more successive file update steps.
Potentially the problem can be resolved if compass watch's compile trigger can be delayed somewhat. For now Dmitri decided to use ftpsync instead.

Make sure that you are using linux line endings in your SASS files, as that is probably making it fail to compile.
When you edit it in windows, it's probably setting it to the windows line ending.
When you then edit it in CentOS, it's probably settings them to the unix line ending.

Related

Sass watch command compiles .scss files before full sftp upload

I use WinSCP to download and edit .scss files and sass on Linux (on the server) to compile them to .css.
After saving the file, I use: sass scss/style.scss css/style.css, which successfully replaces the css file with the compiled sccs.
The problem
I want to skip the part where I return to the command line after editing the scss file, for the sake of automation and saving time.
But, if I use the watch command: sass --watch scss/style.scss:css/style.css to synchronize the two files, alerts about nonexistent css errors pop up:
Change detected to: scss/style.scss
error scss/style.scss (Line 232: Invalid CSS after "...ht: bold; line-": expected "{", was "")
Note that when the file uploads quicker than usual (sometimes it happens) the watch command does its job, with no errors.
This is because, when the file upload takes time, sass compiles the scss file (on the server) before it is fully uploaded to the remote folder. Thus, it only compiles part of the file, resulting in css errors.
Is there a way to set a timer to the watch command so that it waits a few seconds after it detects changes and before compiling?
Any other way to overcome this is, of course, accepted!!
For the one in a billion facing the same problem (I know you are out there), time to answer to my tumbleweed:
The Solution is simple
Do the exact opposite:
Install ruby and then sass on your pc.
Tell sass to watch for changes between scss/css files locally with:sass --watch scss/style.scss:css/style.css
Set WinSCP local dir on the css folder which is watched by sass.
Set the WinSCP remote dir on the css folder you want to edit.
Set WinSCP to keep remote dir up to date from the Commands > Keep remote directory up to date menu.
That's it.
If you edit and save your local scss file, sass will compile it into css, then WinSCP will detect the change on the css and automatically upload it to the remote folder.

Browserify working in some folders in windows, but not others

I'm trying to setup a build flow in a Visual Studio environment (13, on Windows 7) using browserify, and I am getting some strange behaviour trying to get browserify to work. I'm new to the environment as well as the technology, so I'm fairly confused here.
For the purposes of this test, my file structure is the same as the Basic API example found here: http://viget.com/extend/gulp-browserify-starter-faq I installed browserify using npm. It is running version 5.12.0
If I place app.js and hideElement.js in a simple directory, such as C:\Temp, and run
c:\Temp> browserify app.js
everything works fine. It bundles up all three of the required files, and spits them out. But if I run the browserify command from my project directory (C:\Users\\documents\visual studio 2013\Projects\ExcelConverter\ExcelConverterWeb), the following error spits out at me:
C:\Users\<name.redacted>\Documents\Visual Studio 2013\Projects\ExcelConverter\ExcelConverterWeb>browserify app.js
Error: SyntaxError: Unexpected token ? while parsing json file package.json
at fns(C:\Users\<name.redacted>\AppData\Roaming\npm\node_modules\browserify\node_modules\module-deps\index.js:402:30)
at fs.js:271:14
at Object.oncomplete (fs.js:107:15)
I've looked at the file in question, and I can't make heads or tails of it. So, what's going on here? How come browserify runs fine when I execute it from one directory, but not from the other? I appear to be using the same executable.
(I'm trying to use browserify as part of a gulp-based build process, but seeing as the errors produced by gulp are basically the same as those I see when I run from the command line)
I have run into "Unexpected token ?" problem. Changing package.json encoding type to 'ANSI' helped solving it. Most of the text editors have that option when "Save As" change Encoding option, then hit "Save"
See if that work for you.

breakpoint (gem) not found or unreadable

I’m using breakpoint within a serve project. After adding require 'breakpoint' to my './config.ru' and #import 'breakpoint' to my stylesheets, breakpoint works well while running serve (which I actually run via Pow).
However, when using serve export to export the site to static HTML/CSS/JS files within a predetermined folder, I get the following error in my stylesheets:
/*
Syntax error: File to import not found or unreadable: breakpoint.
Load paths:
/Users/agarzola/git/devdev-splash/stylesheets
/Users/agarzola/.rvm/gems/ruby-1.9.2-p290/gems/compass-core-1.0.0.alpha.16/stylesheets
Compass::SpriteImporter
on line 5 of ./stylesheets/screen.sass
1: /Users/agarzola/git/devdev-splash/stylesheets/screen.sass
Backtrace:
./stylesheets/screen.sass:5
[…]
*/
I’ve been poking around the serve gem itself and found that export simply runs compass compile -c '#{#input}/compass.config' '#{#input}' to compile stylesheets before copying them to the destination folder. I had also learned some time ago that the export feature in serve does not yet use config.ru (as it should), and I haven’t been able to figure out where exactly I need to tell compass to use the installed breakpoint gem.
So I tried running compass compile -c ./compass.config and compass watch -c ./compass.config, both of which return a similar error:
error stylesheets/screen.sass (Line 5 of screen.sass: File to import not found or unreadable: breakpoint.
Load paths:
/Users/agarzola/git/devdev-splash/stylesheets
/Users/agarzola/.rvm/gems/ruby-1.9.2-p290/gems/compass-core-1.0.0.alpha.16/stylesheets
Compass::SpriteImporter)
I created an issue on the serve project, but I’m hoping someone here can share some much needed insight. Thanks!
I had a similar issue where I have to uninstall the theme and reinstall because for some reason the gems were not being seem. Post here
After I uninstalled the theme, I ran install bundle and then checked rvm requirements. Then I reinstalled the theme and subtheme. I do not use serve however this could be similar enough that it might work. I did not find anything that helped other then that.

Image paths in Compass CSS on Windows

I've been using SASS and Compass successfully on my Windows 7 x64 machine. Everything was working fine until I tried using the replace-text-with-images mixin.
I placed the image I'm trying to use in the correct place (t:\Website\stylesheets\stylesheets\images for my system), and checked that relative assets are enabled in my Compass config file. Still, when I try to compile, I get this:
t:\Website\stylesheets>compass watch -c config_with_refresh.rb
>>> Change detected to: code-n-apps.scss
WARNING: 'i_user.gif' was not found (or cannot be read) in t:/Website/stylesheets/images
Errno::ENOENT on line ["34"] of C: No such file or directory - t:/Website/stylesheets/images/i_user.gif
Run with --trace to see the full backtrace
>>> Compass is polling for changes. Press Ctrl-C to Stop.
The file is most definitely in that path, and is readable.
Any help would be most appreciated. Ideally, I'd like Compass to grab the images directly off my production server (http), but even having it work locally would be a major improvement.
You say that this is your image-path:
t:\Website\stylesheets\stylesheets\images
Then of course it will not find i_user.gif in
t:/Website/stylesheets/images/
Please double check your path, note that the first time you are using stylesheets/stylesheets and you want to load the image from stylesheets

Error with Compass polling on windows 7

I am attempting to work locally on a PHP application which I cloned from the Git repository my partner and I use.
He uses a Mac, and until now I have been working on the app in a virtual Ubuntu Linux environment. Both environments have been able to use Compass polling with the same file structure and files.
On Windows 7, I run Compass commands from Cygwin, and this is the command I use to have Compass poll from the root directory of the app (C:/wamp/www/application):
compass watch --trace src/Application/ApplicationBundle/Resources/compass/
When I then make a change to a .scss file, I receive the following error:
ArgumentError on line 716 of /usr/lib/ruby/1.8/pathname.rb: different prefix: "/
/cygdrivecwampwwwlimelightsrclimelightlimelightbundleresourcescompasssrcpartials
_object.scss" and "/cygdrive/c/wamp/www/limelight/src/limelight/limelightbundle/
resources/compass/src"
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:81:in 'split_path'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:69:in 'run_callback'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:55:in 'callback_action'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/path.rb:35:in 'update'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:39:in 'modified'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:37:in 'each'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:37:in 'modified'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/state/directory.rb:18:in 'refresh'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'each'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:17:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:15:in 'loop'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/backends/polling.rb:15:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm/monitor.rb:26:in 'run'
/usr/lib/ruby/gems/1.8/gems/fssm-0.2.7/lib/fssm.rb:20:in 'monitor'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/watch_project.rb:86:in 'perform'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/base.rb:18:in 'execute'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/commands/project_base.rb:19:in 'execute'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:43:in 'perform!'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:15:in 'run!'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:25
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:39:in 'call'
/usr/lib/ruby/gems/1.8/gems/compass-0.11.1/bin/compass:39
/usr/bin/compass:19:in 'load'
/usr/bin/compass:19
All I've been able to find through searching is that it may have something to do with the fact that Windows capitalizes its drive names, although the lack of slashes in the returned path makes me think the problem may be elsewhere.
Does anyone know why I might receive this error in Windows, but not other platforms?
NOTE: I have found a work-around involving installing ruby (and compass) through Windows' command prompt rather than Cygwin, and that should work fine for now. Still, if anyone has ideas, I'm still curious as to what the problem could be.
According to this commit, this is a problem caused by a compass dependency called FSSM. It is used to monitor file changes in compass. A workaround is described in this comment.
It seems that FSSM detects that ruby is running inside a Windows box, and treats paths in the Windows' way (C:\blabla). Commenting out the line 26 of the file <fssm_gem_path>/lib/fssm/pathname.rb makes compass watch work as expected. You can also add
unless path[0, 1] == File::SEPARATOR
to the end of line 26 to make it work.
I thought I'd just provide a little more info to help people find the pathname.rb file.
On the cygwin prompt type:
gem env
This (unsurprisingly) brings up a load of info about your Ruby Gems installtion. Look for the line which specifies the INSTALLATION DIRECTORY. Mine was:
/usr/lib/ruby/gems/1.8
Now in Windows Explorer navigate to this location but substitute "usr" for your cygwin installation directory. Therefore the above path becomes:
C:\cygwin\lib\ruby\gems\1.8
Once in this location drill down until you come across the fssm gem directory.
Within this [fssm] directory go into:
/lib/fssm/
...and there you should find the pathname.rb file.
Edit it as above and all is well. I hope this helps.
See here for a possible fix:
http://rails.webintellix.com/2010/05/27/error-in-ruby-relative_path_from-call-on-windows/
I was running into this same error with a slightly different setup. My project folder was on a network drive (ruby and sass/compass installed locally), and every time I made a change to a .scss file compass watch would crash with similar errors to the OP. I solved the issue by mapping my network drive instead of accessing it directly via the network (right clicked on My Computer and choose map network drive so I could access my remote drive at A:).
Now, instead of doing 'compass watch //SERVERNAME/My_Project' (I'm using Git Bash), I do 'compass watch a/My_Project' and compass stopped crashing.
Hope that helps someone else.
Using Cygwin, re install a compass dev release (such as 0.13+). Works for me with Compass 0.13.alpha.4 (Markab)
To do so:
gem uninstall compass
gem install compass --pre --no-rdoc --no-ri

Resources