-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Options documented. #90
Open
Harald-LB
wants to merge
2
commits into
sass:master
Choose a base branch
from
Harald-LB:more-documentation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,11 +37,90 @@ to CSS. To compile, use a `SassC::Engine`, e.g.: | |
SassC::Engine.new(sass, style: :compressed).render | ||
``` | ||
|
||
Here is a more detailed example, which also produces a | ||
[source-map](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k): | ||
|
||
```ruby | ||
template = File.read('styles/mystyle.scss') | ||
|
||
options = { style: :compressed, | ||
filename: 'mystyle.scss', | ||
output_path: 'mystyle.css', | ||
source_map_file: 'mystyle.css.map', | ||
load_paths: ['styles'], | ||
source_map_contents: true } | ||
|
||
engine = SassC::Engine.new(template, options) | ||
|
||
css = engine.render | ||
File.write('styles/mystyle.css', css) | ||
|
||
map = engine.source_map | ||
File.write('styles/mystyle.css.map', map) | ||
``` | ||
|
||
**Note**: If you want to use this library with Rails/Sprockets, check out | ||
[sassc-rails](https://github.com/bolandrm/sassc-rails). | ||
|
||
Additionally, you can use `SassC::Sass2Scss` to convert Sass syntax to Scss syntax. | ||
|
||
### Options | ||
|
||
Options can be set by passing an option-hash to `SassC::Engine.new` as shown in the examples above. | ||
|
||
Available options are: | ||
|
||
* **`:syntax`** | ||
The syntax of the input file, `:sass` for the indented syntax | ||
and `:scss` for the CSS-extension syntax. | ||
Defaults to `:scss`. | ||
|
||
* **`:style`** | ||
Sets the style of the CSS-output. | ||
Can be `:nested`, `:compact`, `:compressed`, or `:expanded`. | ||
See the [SASS_REFERENCE](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style) | ||
for details. | ||
Defaults to `:nested`. | ||
|
||
* **`:filename`** | ||
The name of the file being rendered. | ||
This is used for reporting errors and to reference the main source-file in the _source-map_. | ||
Defaults to `"stdin"`. | ||
|
||
* **`:output_path`** | ||
The path to which the CSS-output will be written to. This value will be used to reference | ||
the generated CCS-file in the _source-map_. | ||
When no value is provided, the _libsass_ library will try to guess this value using the value given in `:filename`. | ||
|
||
* **`:source_map_file`** | ||
The URI of the _source-map_. This information will be written into the compiled CSS-file. | ||
Omitting this information causes no _source-map_ to be generated at all. | ||
|
||
* **`:load_paths`** | ||
An array of filesystem-paths which should be searched for Sass-partials. | ||
|
||
* **`:precision`** | ||
Sets the precision factor used in numeric output. | ||
|
||
* **`:source_map_contents`** | ||
When set to _true_ the full source text will be included in the _source-map_. | ||
Useful for debugging in situations where the server cannot access the original source files. | ||
|
||
* **`:source_map_embed`** | ||
Includes the _source-map_ as a [Data URI](https://en.wikipedia.org/wiki/Data_URI_scheme) into the generated CSS-file. | ||
Note: for security reasons, newer versions of Chrome- (60+) and Firefox- (61+) browsers now block web-pages from navigating | ||
to _data URIs_ so that this option has become rather obsolete. | ||
|
||
* **`:omit_source_map_url`** | ||
When set to _true_ no reference to the _source-map_ file will be emitted into the CSS-file. | ||
|
||
* **`:line_comments`** | ||
When set to _true_ causes the line number and filename of the source be emitted into the compiled CSS-file. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be “to be emitted”? |
||
Useful for debugging when the _source-map_ is not available. | ||
|
||
* **`:quiet`** | ||
When set to _true_ a call to `Engine.render` will not produce any output. | ||
|
||
## Credits | ||
|
||
This gem is maintained by [Ryan Boland](https://ryanboland.com) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the generated CSS-file in the source-map.