def make(self, root=None): u"""The instance of this class builds CSS and HTML files at the optional path *root*. If not defined, then @Builder.C.DEFAULT_ROOTPATH@ is used, as in general builders are associated where output should go to. E.g. the default @HtmlBuilder.C.DEFAULT_ROOTPATH@ is defined as to the user extended path of @~/Desktop/Xierpa3Examples/[component.name]@. And for @CssBuilder@ it is @~/Desktop/Xierpa3Examples/[component.name]/css/style.css@.""" if root is None: root = TX.asDir(self.C.PATH_EXAMPLES) # Expand user path to full directory path. # C S S # Create the main CSS builder instance to build the CSS part of the site. cssBuilder = CssBuilder() # Compile (=build) the SCSS to CSS. self.build(cssBuilder) # Save the file in "css/style.css". cssBuilder.save(self, root=root) # H T M L # Create the main HTML builder instance to build the HTML part of the site. htmlBuilder = HtmlBuilder() # Compile the site instance and its components into HTML code. self.build(htmlBuilder) # Save the resulting HTML file in "helloWorld.html" # Answer the file path, so we can directly open the file with a browser. return htmlBuilder.save(self, root=root)
def make(self, root): u"""The instance of this class builds CSS and HTML files at the optional path <b>root</b>. If not defined, then the default ~/Desktop/Xierpa3Examples/[component.name] is used as export path, as set by Builder.DEFAULT_ROOTPATH""" # Create an "instance" (=object) of type "HelloWorldLayout". The type (=class) defines # the behavior of the object that is made by calling the class. if root is None: root = TX.asDir(self.C.PATH_EXAMPLES ) # Expand user path to full directory path. # C S S # Create the main CSS builder instance to build the SASS/CSS part of the site. cssBuilder = CssBuilder() # Compile (=build) the SCSS to CSS and save the file in "css/style.css". self.build( cssBuilder ) # Build from entire site theme, not just from template. Result is stream in builder. cssBuilder.save(self, root) # H T M L # Create the main HTML builder instance to build the HTML part of the site. htmlBuilder = HtmlBuilder() # Compile the HTML and save the resulting HTML file in "helloWorld.html". self.build( htmlBuilder ) # Build from entire site theme, not just from template. Result is stream in builder. # Answer the path, so we can directly open the file with a browser. return htmlBuilder.save(self, root)
def make(self, root): u"""The instance of this class builds CSS and HTML files at the optional path <b>root</b>. If not defined, then the default ~/Desktop/Xierpa3Examples/[component.name] is used as export path, as set by Builder.DEFAULT_ROOTPATH""" # Create an "instance" (=object) of type "HelloWorldLayout". The type (=class) defines # the behavior of the object that is made by calling the class. if root is None: root = TX.asDir(self.C.PATH_EXAMPLES) # Expand user path to full directory path. # C S S # Create the main CSS builder instance to build the SASS/CSS part of the site. cssBuilder = CssBuilder() # Compile (=build) the SCSS to CSS and save the file in "css/style.css". self.build(cssBuilder) # Build from entire site theme, not just from template. Result is stream in builder. cssBuilder.save(self, root) # H T M L # Create the main HTML builder instance to build the HTML part of the site. htmlBuilder = HtmlBuilder() # Compile the HTML and save the resulting HTML file in "helloWorld.html". self.build(htmlBuilder) # Build from entire site theme, not just from template. Result is stream in builder. # Answer the path, so we can directly open the file with a browser. return htmlBuilder.save(self, root)
def getFilePath(self, component, root=None): u"""Answer the file path of @component@.""" return TX.asDir(root or self.ROOT_PATH) + self.getComponentFileName(root, component)
def getRootDir(cls): u"""Answer the default root directory path, e.g. to store example files and cached SASS/CSS.""" return TX.asDir(cls.C.PATH_EXAMPLES + cls.getPythonClassName().lower() + '/') # Expand user path to full directory path.