Comments (10)
I'm trying to imagine a use case where an absolute path doesn't result in pain, but not finding one. Please enlighten me.
from sass.
It is for a CMS I'm working on. Each widget can add styles to a @mixin based on the widget's name. The @imports are then dynamically built, then the @includes are scoped to a class matching the widget's name, then the whole thing is rendered to CSS. Absolute @imports have worked just fine until 3.1.0.alpha.249; were they not supposed to this whole time?
from sass.
In Sass 3.1, you can build a custom Importer to bring in dynamically generated code. This is vastly preferable to generating code to disk and then importing that.
from sass.
Whether or not this should be supported is up to @nex3, I don't see a good use for it, it results in fragile stylesheets.
from sass.
Absolute path imports seem to work fine for me. Can you post a backtrace, as well as which version of Ruby you're using?
This is not a blocker for 3.1.
from sass.
Oh, please also post the exact Sass code you're using.
from sass.
I am generating the following Sass dynamically, via https://github.com/ravinggenius/scratch_pad/blob/master/lib/sass_builder.rb. This gets converted to CSS, which is then stored in a publicly accessible file. Using compass-0.11.beta.7 and sass-3.1.0....
@charset 'utf-8'
$experimental-support-for-svg: true
$experimental-support-for-khtml: false
$experimental-support-for-microsoft: true
$experimental-support-for-mozilla: false
$experimental-support-for-opera: false
$experimental-support-for-webkit: false
@import '/home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/scratch_pad-themes-default-0.0.1/lib/styles/_variables.sass'
@import 'compass/css3/font-face'
@import 'compass/reset/utilities'
@import 'compass/utilities/lists'
/* zenda license: /assets/theme/default/fonts/Zenda-fontfacekit/Paul%20Lloyd%20License%20Agreement.txt
@include font-face("zenda", font-files('/assets/theme/default/fonts/Zenda-fontfacekit/zenda-webfont.woff', woff, '/assets/theme/default/fonts/Zenda-fontfacekit/zenda-webfont.ttf', truetype, '/assets/theme/default/fonts/Zenda-fontfacekit/zenda-webfont.svg', svg), '/assets/theme/default/fonts/Zenda-fontfacekit/zenda-webfont.eot')
@import '/home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/scratch_pad-widgets-system_menu-0.0.2/lib/styles/all.sass'
@import '/home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/scratch_pad-themes-default-0.0.1/lib/styles/all.sass'
@media all
@include global-reset
@include reset-html5
.system-menu
@include system_menu_all
@include default_all
Stacktrace:
Sass::SyntaxError (File to import not found or unreadable: /home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/scratch_pad-themes-default-0.0.1/lib/styles/_variables.sass.
Load paths:
/home/thomas/Code/ravinggenius-scratch_pad/app/stylesheets
/home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/compass-0.11.beta.7/frameworks/blueprint/stylesheets
/home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/compass-0.11.beta.7/frameworks/compass/stylesheets
/home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/compass-susy-plugin-0.8.1/sass
):
lib/sass_builder.rb:27:in `to_css'
app/controllers/assets_controller.rb:40:in `styles'
Rendered /home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered /home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.9ms)
Rendered /home/thomas/.rvm/gems/ruby-1.9.2-p0@development/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (8.8ms)
Thanks for trying to understand this and help me. I really appreciate the work you guys are doing.
from sass.
@chriseppstein helped me work around this issue by converting the absolute paths to relative paths. Still not sure why the absolute paths wouldn't work.
from sass.
what was the work around? I have a similar issue.
Using absolute paths the first file is imported correctly but instead of importing the second file it seems to import the first file again. (Strange, i know)
At first I suspected a caching issue but even with different filename the behavior remains.
from sass.
@stefankroes I am converting all @import paths from absolute to relative with a bit of Ruby:
def prepare_path_for_import(path)
reply = Pathname.new path
# if the path is absolute, return a relative path
reply.absolute? ? reply.relative_path_from(Pathname.new(Compass.configuration.sass_path)) : reply
end
I am generating this main Sass file in Ruby, so it was pretty easy to add this code to my project. I hope it helps.
from sass.
Related Issues (20)
- Migration from @import to @use and @forward in a scss components library. Willing to pay a consultancy HOT 1
- Migration from @import to @use seems impossible with !default HOT 5
- If Sass also adopts Rust implementation for some implementations, will there be many changes. HOT 1
- How to use $each to set variables HOT 1
- Compatibility with the CSS custom function and mixin proposal HOT 6
- Allow two underscores on index files __index.scss HOT 1
- Node.js Package Importer shouldn't be strict about require.main.filename
- Sass is converting var(--c,) into var(--c) which leads to wrong code HOT 4
- Suggestion: Improve documentation around CSS Layers HOT 6
- Sass break a specific border-image syntax HOT 4
- Handle semicolons as function separators HOT 1
- Support an optional modulus argument to the round() function
- & selector in SCSS and CSS behaves differently HOT 2
- Please remove "free alestine" banner
- Please remove "free Palestine" banner HOT 2
- what is the relation between politics and css? remove that free Palestine immidiatly
- Multi asign, list deconstruction and better support for multiple returns HOT 2
- Generate deprecations list from a single source-of-truth
- Include loaded URLs in failed compilation result HOT 3
- Explicitly allow a base importer without a base URL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sass.