{"action":"created","comment":{"url":"https://api.github.com/repos/sass/node-sass/pulls/comments/24956192","id":24956192,"diff_hunk":"@@ -140,6 +140,14 @@ function getOptions(options) {\n   options.sourceMap = getSourceMap(options);\n   options.style = getStyle(options) || 0;\n \n+  // context object represents node-sass environment\n+  options.context = {\n+    info: module.exports.info,\n+    state: {},\n+    sync: false,","path":"lib/index.js","position":28,"original_position":28,"commit_id":"8db7c4495b14f6d4329f45636ccb855055a0e1b3","original_commit_id":"8db7c4495b14f6d4329f45636ccb855055a0e1b3","user":{"login":"Jakobo","id":1795,"avatar_url":"https://avatars.githubusercontent.com/u/1795?v=3","gravatar_id":"","url":"https://api.github.com/users/Jakobo","html_url":"https://github.com/Jakobo","followers_url":"https://api.github.com/users/Jakobo/followers","following_url":"https://api.github.com/users/Jakobo/following{/other_user}","gists_url":"https://api.github.com/users/Jakobo/gists{/gist_id}","starred_url":"https://api.github.com/users/Jakobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jakobo/subscriptions","organizations_url":"https://api.github.com/users/Jakobo/orgs","repos_url":"https://api.github.com/users/Jakobo/repos","events_url":"https://api.github.com/users/Jakobo/events{/privacy}","received_events_url":"https://api.github.com/users/Jakobo/received_events","type":"User","site_admin":false},"body":"A good example of where these three items are useful is in scenarios where the custom importers (and eventually custom functions) come from npm modules. In these contexts, the importer function probably does not have any information about how it was invoked.\r\n\r\n* state: This persistent object allows an importer or custom function to keep track of data across invocations. An example of this would be providing a custom importer that allows for import-once style functionality. I'm happy to remove this if we would prefer to let custom importer authors develop their own solutions\r\n* sync: At the time of importer, the importer has no knowledge of if it was invoked via render or renderSync. While this is not as important for importers, it is definitely important for custom functions, as some custom functions may only work in a purely async manner. I'd really like to see this stay so that importer/function authors can know more about how they were invoked.\r\n* info: It seemed valuable that an importer (or eventually custom function) could ask about the node-sass / libsass versions. I'm okay with removing this if we don't have a clear use case.","created_at":"2015-02-19T00:30:38Z","updated_at":"2015-02-19T00:30:38Z","html_url":"https://github.com/sass/node-sass/pull/686#discussion_r24956192","pull_request_url":"https://api.github.com/repos/sass/node-sass/pulls/686","_links":{"self":{"href":"https://api.github.com/repos/sass/node-sass/pulls/comments/24956192"},"html":{"href":"https://github.com/sass/node-sass/pull/686#discussion_r24956192"},"pull_request":{"href":"https://api.github.com/repos/sass/node-sass/pulls/686"}}},"pull_request":{"url":"https://api.github.com/repos/sass/node-sass/pulls/686","id":29576595,"html_url":"https://github.com/sass/node-sass/pull/686","diff_url":"https://github.com/sass/node-sass/pull/686.diff","patch_url":"https://github.com/sass/node-sass/pull/686.patch","issue_url":"https://api.github.com/repos/sass/node-sass/issues/686","number":686,"state":"open","locked":false,"title":"Render options in callbacks as this.options","user":{"login":"Jakobo","id":1795,"avatar_url":"https://avatars.githubusercontent.com/u/1795?v=3","gravatar_id":"","url":"https://api.github.com/users/Jakobo","html_url":"https://github.com/Jakobo","followers_url":"https://api.github.com/users/Jakobo/followers","following_url":"https://api.github.com/users/Jakobo/following{/other_user}","gists_url":"https://api.github.com/users/Jakobo/gists{/gist_id}","starred_url":"https://api.github.com/users/Jakobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jakobo/subscriptions","organizations_url":"https://api.github.com/users/Jakobo/orgs","repos_url":"https://api.github.com/users/Jakobo/repos","events_url":"https://api.github.com/users/Jakobo/events{/privacy}","received_events_url":"https://api.github.com/users/Jakobo/received_events","type":"User","site_admin":false},"body":"Replaces #681 (single focused commit based on sass/node-sass@master)\r\n\r\nThis patch and tests introduces a context for all callbacks currently\r\nin node-sass. Right now, they run w/ an ambiguous context, making the\r\n`this` keyword not helpful to importer developers (and eventually\r\ncustom function developers). This creates a context object, adds the\r\nrender options to said context object, and then uses that context for\r\nimporter, success, and error callbacks via `this.options`.\r\n\r\nBy using a context instead of just `.call(options...)` there is a hook\r\nfor later should we find additional environmental information is\r\nvaluable to importer / custom function developers such as the node\r\nenvironment, node-sass version, etc.\r\n\r\nAdditionally, info() is exposed in the context so any node modules\r\nimported would be able to determine the libsass & node-sass versions\r\nused during the render call.","created_at":"2015-02-19T00:11:01Z","updated_at":"2015-02-19T00:30:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6acf742ed4e62ecda6089b7cd81ef48781215ed4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sass/node-sass/pulls/686/commits","review_comments_url":"https://api.github.com/repos/sass/node-sass/pulls/686/comments","review_comment_url":"https://api.github.com/repos/sass/node-sass/pulls/comments/{number}","comments_url":"https://api.github.com/repos/sass/node-sass/issues/686/comments","statuses_url":"https://api.github.com/repos/sass/node-sass/statuses/8db7c4495b14f6d4329f45636ccb855055a0e1b3","head":{"label":"Jakobo:test_options2","ref":"test_options2","sha":"8db7c4495b14f6d4329f45636ccb855055a0e1b3","user":{"login":"Jakobo","id":1795,"avatar_url":"https://avatars.githubusercontent.com/u/1795?v=3","gravatar_id":"","url":"https://api.github.com/users/Jakobo","html_url":"https://github.com/Jakobo","followers_url":"https://api.github.com/users/Jakobo/followers","following_url":"https://api.github.com/users/Jakobo/following{/other_user}","gists_url":"https://api.github.com/users/Jakobo/gists{/gist_id}","starred_url":"https://api.github.com/users/Jakobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jakobo/subscriptions","organizations_url":"https://api.github.com/users/Jakobo/orgs","repos_url":"https://api.github.com/users/Jakobo/repos","events_url":"https://api.github.com/users/Jakobo/events{/privacy}","received_events_url":"https://api.github.com/users/Jakobo/received_events","type":"User","site_admin":false},"repo":{"id":30803602,"name":"node-sass","full_name":"Jakobo/node-sass","owner":{"login":"Jakobo","id":1795,"avatar_url":"https://avatars.githubusercontent.com/u/1795?v=3","gravatar_id":"","url":"https://api.github.com/users/Jakobo","html_url":"https://github.com/Jakobo","followers_url":"https://api.github.com/users/Jakobo/followers","following_url":"https://api.github.com/users/Jakobo/following{/other_user}","gists_url":"https://api.github.com/users/Jakobo/gists{/gist_id}","starred_url":"https://api.github.com/users/Jakobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jakobo/subscriptions","organizations_url":"https://api.github.com/users/Jakobo/orgs","repos_url":"https://api.github.com/users/Jakobo/repos","events_url":"https://api.github.com/users/Jakobo/events{/privacy}","received_events_url":"https://api.github.com/users/Jakobo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Jakobo/node-sass","description":":rainbow: Node.js bindings to libsass","fork":true,"url":"https://api.github.com/repos/Jakobo/node-sass","forks_url":"https://api.github.com/repos/Jakobo/node-sass/forks","keys_url":"https://api.github.com/repos/Jakobo/node-sass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jakobo/node-sass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jakobo/node-sass/teams","hooks_url":"https://api.github.com/repos/Jakobo/node-sass/hooks","issue_events_url":"https://api.github.com/repos/Jakobo/node-sass/issues/events{/number}","events_url":"https://api.github.com/repos/Jakobo/node-sass/events","assignees_url":"https://api.github.com/repos/Jakobo/node-sass/assignees{/user}","branches_url":"https://api.github.com/repos/Jakobo/node-sass/branches{/branch}","tags_url":"https://api.github.com/repos/Jakobo/node-sass/tags","blobs_url":"https://api.github.com/repos/Jakobo/node-sass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jakobo/node-sass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jakobo/node-sass/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jakobo/node-sass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jakobo/node-sass/statuses/{sha}","languages_url":"https://api.github.com/repos/Jakobo/node-sass/languages","stargazers_url":"https://api.github.com/repos/Jakobo/node-sass/stargazers","contributors_url":"https://api.github.com/repos/Jakobo/node-sass/contributors","subscribers_url":"https://api.github.com/repos/Jakobo/node-sass/subscribers","subscription_url":"https://api.github.com/repos/Jakobo/node-sass/subscription","commits_url":"https://api.github.com/repos/Jakobo/node-sass/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jakobo/node-sass/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jakobo/node-sass/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jakobo/node-sass/issues/comments/{number}","contents_url":"https://api.github.com/repos/Jakobo/node-sass/contents/{+path}","compare_url":"https://api.github.com/repos/Jakobo/node-sass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jakobo/node-sass/merges","archive_url":"https://api.github.com/repos/Jakobo/node-sass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jakobo/node-sass/downloads","issues_url":"https://api.github.com/repos/Jakobo/node-sass/issues{/number}","pulls_url":"https://api.github.com/repos/Jakobo/node-sass/pulls{/number}","milestones_url":"https://api.github.com/repos/Jakobo/node-sass/milestones{/number}","notifications_url":"https://api.github.com/repos/Jakobo/node-sass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jakobo/node-sass/labels{/name}","releases_url":"https://api.github.com/repos/Jakobo/node-sass/releases{/id}","created_at":"2015-02-14T17:41:35Z","updated_at":"2015-02-14T17:41:36Z","pushed_at":"2015-02-19T00:09:42Z","git_url":"git://github.com/Jakobo/node-sass.git","ssh_url":"git@github.com:Jakobo/node-sass.git","clone_url":"https://github.com/Jakobo/node-sass.git","svn_url":"https://github.com/Jakobo/node-sass","homepage":"https://npmjs.org/package/node-sass","size":14454,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sass:master","ref":"master","sha":"4c14f27e787c337ce0a027b03dbd3010229b5c61","user":{"login":"sass","id":317889,"avatar_url":"https://avatars.githubusercontent.com/u/317889?v=3","gravatar_id":"","url":"https://api.github.com/users/sass","html_url":"https://github.com/sass","followers_url":"https://api.github.com/users/sass/followers","following_url":"https://api.github.com/users/sass/following{/other_user}","gists_url":"https://api.github.com/users/sass/gists{/gist_id}","starred_url":"https://api.github.com/users/sass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sass/subscriptions","organizations_url":"https://api.github.com/users/sass/orgs","repos_url":"https://api.github.com/users/sass/repos","events_url":"https://api.github.com/users/sass/events{/privacy}","received_events_url":"https://api.github.com/users/sass/received_events","type":"Organization","site_admin":false},"repo":{"id":4128353,"name":"node-sass","full_name":"sass/node-sass","owner":{"login":"sass","id":317889,"avatar_url":"https://avatars.githubusercontent.com/u/317889?v=3","gravatar_id":"","url":"https://api.github.com/users/sass","html_url":"https://github.com/sass","followers_url":"https://api.github.com/users/sass/followers","following_url":"https://api.github.com/users/sass/following{/other_user}","gists_url":"https://api.github.com/users/sass/gists{/gist_id}","starred_url":"https://api.github.com/users/sass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sass/subscriptions","organizations_url":"https://api.github.com/users/sass/orgs","repos_url":"https://api.github.com/users/sass/repos","events_url":"https://api.github.com/users/sass/events{/privacy}","received_events_url":"https://api.github.com/users/sass/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sass/node-sass","description":":rainbow: Node.js bindings to libsass","fork":false,"url":"https://api.github.com/repos/sass/node-sass","forks_url":"https://api.github.com/repos/sass/node-sass/forks","keys_url":"https://api.github.com/repos/sass/node-sass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sass/node-sass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sass/node-sass/teams","hooks_url":"https://api.github.com/repos/sass/node-sass/hooks","issue_events_url":"https://api.github.com/repos/sass/node-sass/issues/events{/number}","events_url":"https://api.github.com/repos/sass/node-sass/events","assignees_url":"https://api.github.com/repos/sass/node-sass/assignees{/user}","branches_url":"https://api.github.com/repos/sass/node-sass/branches{/branch}","tags_url":"https://api.github.com/repos/sass/node-sass/tags","blobs_url":"https://api.github.com/repos/sass/node-sass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sass/node-sass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sass/node-sass/git/refs{/sha}","trees_url":"https://api.github.com/repos/sass/node-sass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sass/node-sass/statuses/{sha}","languages_url":"https://api.github.com/repos/sass/node-sass/languages","stargazers_url":"https://api.github.com/repos/sass/node-sass/stargazers","contributors_url":"https://api.github.com/repos/sass/node-sass/contributors","subscribers_url":"https://api.github.com/repos/sass/node-sass/subscribers","subscription_url":"https://api.github.com/repos/sass/node-sass/subscription","commits_url":"https://api.github.com/repos/sass/node-sass/commits{/sha}","git_commits_url":"https://api.github.com/repos/sass/node-sass/git/commits{/sha}","comments_url":"https://api.github.com/repos/sass/node-sass/comments{/number}","issue_comment_url":"https://api.github.com/repos/sass/node-sass/issues/comments/{number}","contents_url":"https://api.github.com/repos/sass/node-sass/contents/{+path}","compare_url":"https://api.github.com/repos/sass/node-sass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sass/node-sass/merges","archive_url":"https://api.github.com/repos/sass/node-sass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sass/node-sass/downloads","issues_url":"https://api.github.com/repos/sass/node-sass/issues{/number}","pulls_url":"https://api.github.com/repos/sass/node-sass/pulls{/number}","milestones_url":"https://api.github.com/repos/sass/node-sass/milestones{/number}","notifications_url":"https://api.github.com/repos/sass/node-sass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sass/node-sass/labels{/name}","releases_url":"https://api.github.com/repos/sass/node-sass/releases{/id}","created_at":"2012-04-24T18:46:30Z","updated_at":"2015-02-18T14:30:23Z","pushed_at":"2015-02-15T23:38:57Z","git_url":"git://github.com/sass/node-sass.git","ssh_url":"git@github.com:sass/node-sass.git","clone_url":"https://github.com/sass/node-sass.git","svn_url":"https://github.com/sass/node-sass","homepage":"https://npmjs.org/package/node-sass","size":17845,"stargazers_count":1407,"watchers_count":1407,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":200,"mirror_url":null,"open_issues_count":21,"forks":200,"open_issues":21,"watchers":1407,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sass/node-sass/pulls/686"},"html":{"href":"https://github.com/sass/node-sass/pull/686"},"issue":{"href":"https://api.github.com/repos/sass/node-sass/issues/686"},"comments":{"href":"https://api.github.com/repos/sass/node-sass/issues/686/comments"},"review_comments":{"href":"https://api.github.com/repos/sass/node-sass/pulls/686/comments"},"review_comment":{"href":"https://api.github.com/repos/sass/node-sass/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/sass/node-sass/pulls/686/commits"},"statuses":{"href":"https://api.github.com/repos/sass/node-sass/statuses/8db7c4495b14f6d4329f45636ccb855055a0e1b3"}}}}