-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from mpvue/develop
Develop
- Loading branch information
Showing
5 changed files
with
108 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
function genScript (name, isPage) { | ||
const prefix = isPage ? '../..' : '.' | ||
const { getPathPrefix } = require('./util') | ||
|
||
function genScript (name, isPage, src) { | ||
const prefix = isPage ? getPathPrefix(src) : '.' | ||
|
||
return ` | ||
import '${prefix}/static/js/manifest' | ||
import '${prefix}/static/js/vendor' | ||
import '${prefix}/static/js/${name}' | ||
` | ||
require('${prefix}/static/js/manifest') | ||
require('${prefix}/static/js/vendor') | ||
require('${prefix}/static/js/${name}') | ||
` | ||
} | ||
|
||
function genStyle (name, isPage) { | ||
const prefix = isPage ? '../..' : '.' | ||
function genStyle (name, isPage, src) { | ||
const prefix = isPage ? getPathPrefix(src) : '.' | ||
return `@import "${prefix}/static/css/${name}.wxss";` | ||
} | ||
|
||
function genPageWxml (templateName) { | ||
return `<import src="../../components/${templateName}" /><template is="${templateName}" data="{{ ...$root['0'], $root }}"/>` | ||
function genPageWxml (templateName, src) { | ||
return `<import src="${getPathPrefix(src)}components/${templateName}" /><template is="${templateName}" data="{{ ...$root['0'], $root }}"/>` | ||
} | ||
|
||
module.exports = { genScript, genStyle, genPageWxml } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters