81075

Why is Compass is giving me an import error when trying to import partials

My compass project directory structure looks like this

s3z@s3z:~/Desktop/compass_project$ tree . ├── basic.html ├── config.rb ├── css │   ├── ie.css │   ├── print.css │   └── screen.css ├── index.html ├── partials │   └── _normalize.scss └── sass ├── ie.scss ├── print.scss └── screen.scss

My screen.scss file looks like this

@import "compass"; @import "partials/normalize";

When I add @import "partials/normalize"; and save it, Compass spits the following error back at me

>>> Compass is watching for changes. Press Ctrl-C to Stop. >>> Change detected at 22:58:53 to: screen.scss error sass/screen.scss (Line 2: File to import not found or unreadable: partials/normalize. Load paths: /home/max/Desktop/nettut_compass_tut/sass /home/max/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/blueprint/stylesheets /home/max/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets Compass::SpriteImporter) overwrite ./css/screen.css

And just in case it matters my config.rb is

http_path = "/" css_dir = "css" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts"

<strong>Any ideas on how to fix this?</strong>

Answer1:

You've defined your sass_dir as sass so compass is looking for that reset file in: sass/partials/normalize If you want to import something outside of your sass_dir, you need to use a path relative to the sass file that's doing the importing:

@import "../partials/normalize";

personally, I prefer to put the partial directory in the sass directory, or just let them sort to the top loose.

Recommend

  • Algorithm for detecting Movement (Forward/Backward) on the iPhone?
  • How can i create SASS mixins and use in every project
  • Cannot load Windows PowerShell snap-in Microsoft.PowerShell.Host
  • Laravel 5: Validating Edits In-Place
  • Not able to move map after starting Navigation SKMAPS
  • How to reposition compass of MKMapView?
  • Eclipse unable to get info on the interpreter in virtual environment
  • d3.js - Tree Layout - How can I flip it?
  • How to normalize a database schema
  • Build URLS from JSON
  • C#: Import/Export Settings into/from a File
  • How can I set a binding to a Combox in a UserControl?
  • AJAX Html Editor Extender upload image appearing blank
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Python: how to group similar lists together in a list of lists?
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Free memory of cv::Mat loaded using FileStorage API
  • Hits per day in Google Big Query
  • Angular 2 constructor injection vs direct access
  • Trying to get generic when generic is not available
  • coudnt use logback because of log4j
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Getting Messege Twice Using IMvxMessenger
  • Java static initializers and reflection
  • Change div Background jquery
  • Android Google Maps API OnLocationChanged only called once
  • How to get Windows thread pool to call class member function?
  • Linking SubReports Without LinkChild/LinkMaster
  • Bitwise OR returns boolean when one of operands is nil
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?