Bs-Harp + DreamWeaver Templates/Libraries
Bs-Harp内にDreamWeaverのTemplates/Librariesを埋め込む
Harp - the static web server with built-in preprocessing
$ sudo npm install -g harp
$ npm install
Start http://localhost:9000
$ harp server
and start proxying: http://localhost:9000 and http://localhost:3000
$ npm start
When you write the code to jade files , there is a need to write root path.
img(src="/images/demo.png", alt="demo")
control + c
Compile source non-minify-html in /dist
If you don't need to convert relative path to the dist directory, you change config.relativePath to false in gulpfile.js.
$ harp compile;gulp clean:dist;gulp dist;gulp dw;gulp clean:distTem
- DreamWeaver Template File
/public/Templates/layout.jade
use Harp's Layout(a common template) /public/_layout.jade
include _mixins
doctype
html(lang="en")
if templateName
<!-- InstanceBegin template="/Templates/#{templateName}.dwt" codeOutsideHTMLIsLocked="false" -->
head
meta(charset="utf-8")
+dwcStart("doctitle")
title= title
+dwcEnd
+dwcStart("head")
meta(name="keywords" content="#{keywords}")
meta(name="description" content="#{description}")
+dwcEnd
link(rel="stylesheet" href="/css/main.css")
body
block main
!= partial("_header")
+dwcStart("contents")
!= yield
+dwcEnd
script(src="/js/jquery.min.js")
script(src="/js/bootstrap.min.js")
script(src="/js/custom.js")
if templateName
<!-- InstanceEnd -->
- add DreamWeaver Template Editable Area
+dwcStart("contents") // Editable Area Name
...
+dwcEnd
- DreamWeaver Library File
/public/Library/header.jade
use Harp's Partial /public/Library/_header.jade
include _mixins
+dwLibStart("header") // Library Name
.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
...
+dwLibEnd
-
use jade mixins(
/public/_mixins.jade
)in these filesinclude _mixins
-
add
title
,keywords
,description
andtemplateName
in each_data.json
files
templateName
is using DreamWeaver Template File's name.
{
"index": {
"title": "Home",
"keywords": "keywords sample Home",
"description": "keywords sample Home",
"templateName": "layout"
},...
- add DreamWeaver Library
create Harp's Partial , wrap with the following code , and add jade file in Libraries directory with Library Name.
include _mixins
+dwLibStart("header") // Library Name
...
+dwLibEnd
Bs-Harp v.1.2.0から作成