Skip to content
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

Add configuration parameter for ASSETS_URL #101

Merged
merged 1 commit into from Feb 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion scss/__init__.py
Expand Up @@ -2770,7 +2770,7 @@ def _sprite_map(g, **kwargs):
times.append(int(os.path.getmtime(file)))

map_name = os.path.normpath(os.path.dirname(g)).replace('\\', '_').replace('/', '_')
key = list(zip(*files)[0]) + times + [repr(kwargs)]
key = list(zip(*files)[0]) + times + [repr(kwargs), ASSETS_URL]
key = map_name + '-' + base64.urlsafe_b64encode(hashlib.md5(repr(key)).digest()).rstrip('=').replace('-', '_')
asset_file = key + '.png'
asset_path = os.path.join(ASSETS_ROOT, asset_file)
Expand Down
4 changes: 4 additions & 0 deletions scss/tool.py
Expand Up @@ -58,6 +58,8 @@ def main():
help="Static root path (Where images and static resources are located)")
paths_group.add_option("-A", "--assets-root", metavar="PATH", dest="assets_root",
help="Assets root path (Sprite images will be created here)")
paths_group.add_option("-a", "--assets-url", metavar="URL", dest="assets_url",
help="URL to reach the files in your assets_root")
parser.add_option_group(paths_group)

(options, args) = parser.parse_args()
Expand Down Expand Up @@ -89,6 +91,8 @@ def main():
scss.LOAD_PATHS = ','.join(load_path_list)
else:
scss.LOAD_PATHS = load_path_list
if options.assets_url is not None:
scss.ASSETS_URL = options.assets_url

# Execution modes
if options.test:
Expand Down