本文整理汇总了Python中xierpa3.toolbox.transformer.TX.asDir方法的典型用法代码示例。如果您正苦于以下问题:Python TX.asDir方法的具体用法?Python TX.asDir怎么用?Python TX.asDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xierpa3.toolbox.transformer.TX
的用法示例。
在下文中一共展示了TX.asDir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make
# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import asDir [as 别名]
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 @[email protected] is used, as in general builders
are associated where output should go to.
E.g. the default @[email protected] is defined as to the user extended
path of @~/Desktop/Xierpa3Examples/[component.name]@.
And for @[email protected] it is @~/Desktop/Xierpa3Examples/[component.name]/css/[email protected]"""
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)
示例2: make
# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import asDir [as 别名]
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)
示例3: getFilePath
# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import asDir [as 别名]
def getFilePath(self, component, root=None):
u"""Answer the file path of @[email protected]"""
return TX.asDir(root or self.ROOT_PATH) + self.getComponentFileName(root, component)
示例4: getRootDir
# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import asDir [as 别名]
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.