author | Josh <jokajak@gmail.com> | 2012-03-17 19:29:33 (UTC) |
---|---|---|
committer | Josh <jokajak@gmail.com> | 2012-03-17 19:29:33 (UTC) |
commit | 0e396afdc4aa9ec8734ba48f90e9fefbad3b2b33 (patch) (side-by-side diff) | |
tree | 2ace8ec32d24c1d34b4578fe9297c4e4b4b97720 /scripts/builder/frontendBuilder.py | |
parent | ff33328861685c1a2d5f9b729a2b3595509c38ee (diff) | |
parent | 6f7ead0446aae6dd9f40b183e402b059a33d0517 (diff) | |
download | clipperz-0e396afdc4aa9ec8734ba48f90e9fefbad3b2b33.zip clipperz-0e396afdc4aa9ec8734ba48f90e9fefbad3b2b33.tar.gz clipperz-0e396afdc4aa9ec8734ba48f90e9fefbad3b2b33.tar.bz2 |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'scripts/builder/frontendBuilder.py') (more/less context) (ignore whitespace changes)
-rw-r--r-- | scripts/builder/frontendBuilder.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/builder/frontendBuilder.py b/scripts/builder/frontendBuilder.py index dae837b..1f0f92f 100644 --- a/scripts/builder/frontendBuilder.py +++ b/scripts/builder/frontendBuilder.py @@ -75,33 +75,34 @@ class FrontendBuilder(object): for file in self.filterFiles(files): try: fileHandler = codecs.open(self.absolutePathForSourceFile(basePath, file), 'r', 'utf-8') except: print "FILE: " + file result += fileHandler.read() + '\n' fileHandler.close() return result def template (self): processedFile = 'html_template' if not self.processedFiles.has_key(processedFile): - self.processedFiles[processedFile] = self.loadFilesContent('html', ['index_template.html']) + # self.processedFiles[processedFile] = self.loadFilesContent('html', ['index_template.html']) + self.processedFiles[processedFile] = self.loadFilesContent('html', [self.settings['html.template']]) return self.processedFiles[processedFile] def cssminCompressor (self, css): # package found here: # - http://stackoverflow.com/questions/222581/python-script-for-minifying-css/2396777#2396777 # actual downloaded version: http://pypi.python.org/pypi/cssmin/0.1.4 return cssmin.cssmin(css) def regexCssCompressor (self, css): # http://stackoverflow.com/questions/222581/python-script-for-minifying-css/223689#223689 # remove comments - this will break a lot of hacks :-P css = re.sub( r'\s*/\*\s*\*/', "$$HACK1$$", css ) # preserve IE<6 comment hack @@ -306,33 +307,33 @@ class FrontendBuilder(object): self.processedFiles[processedFile] = result return self.processedFiles[processedFile] def cssTagsForFiles (self, basePath, files): #<link rel="stylesheet" type="text/css" href="./css/reset-min.css" /> return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="' + basePath + '/' + file + '" />', files)) def cssTagForContent (self, content): return '<style type="text/css">' + content + '</style>' def scriptTagsForFiles (self, basePath, files): #<script type='text/javascript' src='./js/src/bookmarklet.js'></script> - return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '"></script>', files)) + return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '" charset="utf-8"></script>', files)) def scriptTagForContent (self, content): return '<script>' + content + '</script>' def assembleVersion (self, pageTitle, copyright, css, js, jsLoadMode, version, versionType): cacheKey = version + "-" + versionType if not self.processedFiles.has_key(cacheKey): result = self.replaceTemplatePlaceholders(pageTitle, copyright, css, js, jsLoadMode, version, versionType) self.processedFiles[cacheKey] = result else: result = self.processedFiles[cacheKey] #self.log("# cacheKey:\n" + result) return result |