Skip to content

Commit

Permalink
API: Retires non-standard image-path option.
Browse files Browse the repository at this point in the history
Issue URL: sass#702.
PR URL: sass#704.
  • Loading branch information
am11 committed Feb 25, 2015
1 parent 9cc9b31 commit 0c586e1
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 59 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ The options passed in to `render` and `renderSync` are available as `this.option
#### includePaths
`includePaths` is an `Array` of path `String`s to look for any `@import`ed files. It is recommended that you use this option if you are using the `data` option and have **any** `@import` directives, as otherwise [libsass] may not find your depended-on files.

#### imagePath
`imagePath` is a `String` that represents the public image path. When using the `image-url()` function in a stylesheet, this path will be prepended to the path you supply. eg. Given an `imagePath` of `/path/to/images`, `background-image: image-url('image.png')` will compile to `background-image: url("/path/to/images/image.png")`

#### indentedSyntax
`indentedSyntax` is a `Boolean` flag to determine if [Sass Indented Syntax](http://sass-lang.com/documentation/file.INDENTED_SYNTAX.html) should be used to parse provided string or a file.

Expand Down Expand Up @@ -338,7 +335,6 @@ Output will be saved with the same name as input SASS file into the current work
--source-map-embed Embed sourceMappingUrl as data URI
--source-map-contents Embed include contents in map
--include-path Path to look for imported files
--image-path Path to prepend when using the `image-url()` helper
--precision The amount of precision allowed in decimal numbers
--importer Path to custom importer
--help Print usage info
Expand Down
3 changes: 0 additions & 3 deletions bin/node-sass
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ var cli = meow({
' --source-map-embed Embed sourceMappingUrl as data URI',
' --source-map-contents Embed include contents in map',
' --include-path Path to look for imported files',
' --image-path Path to prepend when using the `image-url()` helper',
' --precision The amount of precision allowed in decimal numbers',
' --importer Path to custom importer',
' --help Print usage info'
Expand All @@ -51,7 +50,6 @@ var cli = meow({
'source-comments'
],
string: [
'image-path',
'include-path',
'output',
'output-style',
Expand All @@ -66,7 +64,6 @@ var cli = meow({
r: 'recursive'
},
default: {
'image-path': '',
'include-path': process.cwd(),
'output-style': 'nested',
precision: 5
Expand Down
7 changes: 3 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function endStats(stats) {
*/

function getStyle(options) {
var style = options.output_style || options.outputStyle;
var style = options.outputStyle;
var styles = {
nested: 0,
expanded: 1,
Expand Down Expand Up @@ -129,12 +129,11 @@ function getSourceMap(options) {
*/
function getOptions(options, cb) {
options = options || {};
options.comments = options.source_comments || options.sourceComments || false;
options.comments = options.sourceComments || false;
options.data = options.data || null;
options.file = options.file || null;
options.imagePath = options.image_path || options.imagePath || '';
options.outFile = getOutFile(options);
options.paths = (options.include_paths || options.includePaths || []).join(path.delimiter);
options.paths = (options.includePaths || []).join(path.delimiter);
options.precision = parseInt(options.precision) || 5;
options.sourceMap = getSourceMap(options);
options.style = getStyle(options) || 0;
Expand Down
1 change: 0 additions & 1 deletion lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ var fs = require('fs'),

module.exports = function(options, emitter) {
var renderOptions = {
imagePath: options.imagePath,
includePaths: options.includePath,
omitSourceMapUrl: options.omitSourceMapUrl,
indentedSyntax: options.indentedSyntax,
Expand Down
1 change: 0 additions & 1 deletion src/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ void extract_options(Local<Object> options, void* cptr, sass_context_wrapper* ct
}

sass_option_set_output_path(sass_options, create_string(options->Get(NanNew("outFile"))));
sass_option_set_image_path(sass_options, create_string(options->Get(NanNew("imagePath"))));
sass_option_set_output_style(sass_options, (Sass_Output_Style)options->Get(NanNew("style"))->Int32Value());
sass_option_set_is_indented_syntax_src(sass_options, options->Get(NanNew("indentedSyntax"))->BooleanValue());
sass_option_set_source_comments(sass_options, options->Get(NanNew("comments"))->BooleanValue());
Expand Down
27 changes: 0 additions & 27 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,33 +114,6 @@ describe('api', function() {
});
});

it('should compile with image path', function(done) {
var src = read(fixture('image-path/index.scss'), 'utf8');
var expected = read(fixture('image-path/expected.css'), 'utf8').trim();

sass.render({
data: src,
imagePath: '/path/to/images',
success: function(result) {
assert.equal(result.css.trim(), expected.replace(/\r\n/g, '\n'));
done();
}
});
});

it('should throw error with non-string image path', function(done) {
var src = read(fixture('image-path/index.scss'), 'utf8');

assert.throws(function() {
sass.render({
data: src,
imagePath: ['/path/to/images']
});
});

done();
});

it('should render with --precision option', function(done) {
var src = read(fixture('precision/index.scss'), 'utf8');
var expected = read(fixture('precision/expected.css'), 'utf8').trim();
Expand Down
14 changes: 0 additions & 14 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,6 @@ describe('cli', function() {

src.pipe(bin.stdin);
});

it('should compile with the --image-path option', function(done) {
var src = fs.createReadStream(fixture('image-path/index.scss'));
var expected = read(fixture('image-path/expected.css'), 'utf8').trim();
var bin = spawn(cli, ['--image-path', '/path/to/images']);

bin.stdout.setEncoding('utf8');
bin.stdout.once('data', function(data) {
assert.equal(data.trim(), expected.replace(/\r\n/g, '\n'));
done();
});

src.pipe(bin.stdin);
});
});

describe('node-sass in.scss', function() {
Expand Down
2 changes: 0 additions & 2 deletions test/fixtures/image-path/expected.css

This file was deleted.

3 changes: 0 additions & 3 deletions test/fixtures/image-path/index.scss

This file was deleted.

0 comments on commit 0c586e1

Please sign in to comment.