Example #1
0
 def save(self, cssPath=None, scssPath=None, styleType=None):
     u"""
     Style type is one of ['nested', 'expanded', 'compact', 'compressed'].
     Given by self.e.form['css'].
     """
     if self.e is not None: # Is there a server environment, then overwrite the style type.
         styleType = self.e.form[self.PARAM_CSS] or styleType
     if not styleType in self.SASS_STYLES:
         styleType = self.SASS_DEFAULTSTYLE
     if cssPath is None:
         cssPath = '/tmp/style.css'
     if scssPath is None:
         scssPath = cssPath.replace('.css', '.scss')
     SassBuilder.save(self, scssPath)
     os.system('sass --trace %s %s --style %s' % (scssPath, cssPath, styleType))
     f = open(cssPath, 'r')
     self.css = f.read()
     f.close()
Example #2
0
 def save(self, component, path=None, styleType=None):
     u"""
     Style type is one of ['nested', 'expanded', 'compact', 'compressed'].
     Given by the url parameter "/css-nested".
     """
     # Is there a server environment, then overwrite the style type.
     if self.e is not None: 
         styleType = self.e.form[self.PARAM_CSS] or styleType
     if not styleType in self.SASS_STYLES:
         styleType = self.SASS_DEFAULTSTYLE
     if path is None:
         path = self.getExportPath(component) + '/' + self.DEFAULT_PATH
     scssPath = path.replace('.css', '.scss')
     SassBuilder.save(self, component, path=scssPath)
     # Call external sass application to always compile SCSS into CSS
     os.system('sass --trace %s %s --style %s' % (scssPath, path, styleType))
     # Read the compiled CSS into self.css to be answered as result of this builder.
     f = open(path, 'r')
     self.css = f.read()
     f.close()
     return path
Example #3
0
 def save(self, component, path=None, styleType=None):
     u"""
     Style type is one of ['nested', 'expanded', 'compact', 'compressed'].
     Given by the url parameter "/css-nested".
     """
     # Is there a server environment, then overwrite the style type.
     if self.e is not None:
         styleType = self.e.form[self.PARAM_CSS] or styleType
     if not styleType in self.SASS_STYLES:
         styleType = self.SASS_DEFAULTSTYLE
     if path is None:
         path = self.getExportPath(component) + '/' + self.DEFAULT_PATH
     scssPath = path.replace('.css', '.scss')
     SassBuilder.save(self, component, path=scssPath)
     # Call external sass application to always compile SCSS into CSS
     os.system('sass --trace %s %s --style %s' %
               (scssPath, path, styleType))
     # Read the compiled CSS into self.css to be answered as result of this builder.
     f = open(path, 'r')
     self.css = f.read()
     f.close()
     return path
Example #4
0
 def save(self, component, path=None, root=None, styleType=None):
     u"""
     Style type is one of ['nested', 'expanded', 'compact', 'compressed'].
     Given by the url parameter "/css-nested".
     """
     # Is there a server environment, then overwrite the style type.
     if self.e is not None: 
         styleType = self.e.form[self.C.PARAM_CSSTYPE] or styleType or 'expanded'
     if not styleType in self.C.SASS_STYLES:
         styleType = self.C.SASS_DEFAULTSTYLE
     if path is None: # Allow full overwrite of complete path.
         assert root is not None # Always needs external root path defined.
         path = self.getFilePath(component, root)
     scssPath = path.replace('.css', '.scss')
     SassBuilder.save(self, component, path=scssPath)
     # Call external sass application to always compile SCSS into CSS
     os.system('sass --trace %s %s --style %s; chmod a+r %s' % (scssPath, path, styleType, path))
     # Read the compiled CSS into self.css to be answered as result of this builder.
     f = open(path, 'r')
     self.css = f.read()
     f.close()
     return path
Example #5
0
 def initialize(self):
     SassBuilder.initialize(self)
     self.css = None
Example #6
0
 def initialize(self):
     SassBuilder.initialize(self)
     self.css = None
Example #7
0
        ), id='sidebar', width='38%', float='left'
    )
    main = Group(components=(
        Header(Text('Header of the page', fontsize=50, color='red')),
        Article(Text('This is a text. ' * 40)),
        Header(Text('Another header')),
        Article(Text('This is another text. ' * 20)),
        ), id='main', width='60%', float='left'
    )
    contact = Group(components=(
        Header(Text('Contact', fontsize=50), name='Contact'))
    )
    components = (
        Page(name='index', components=(main, sidebar), style=style),
        Page(name='contact', components=(contact, sidebar), style=style)
    )
    t = Theme(components)
    hb = HtmlBuilder()
    for page in t.pages:
        page.build(hb) # Clear the builder and build the HTML for page
        hb.save('/Library/WebServer/Documents/xierpa3/%s.html' % page.name)
        print hb.getResult()
        print
        print

    sb = SassBuilder()
    t.build(sb)
    sb.save('/Library/WebServer/Documents/xierpa3/style.scss')
    print sb.getResult()