Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #50 from markbates/resource-model
Browse files Browse the repository at this point in the history
generate js & css files into sub directory of assets
  • Loading branch information
markbates authored Dec 12, 2016
2 parents b98d1af + 63aea18 commit 2748fe5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions buffalo/cmd/app_generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func newAppGenerator() *gentronics.Generator {
g.Add(gentronics.NewFile("grifts/routes.go", nGriftRoutes))
g.Add(gentronics.NewFile("templates/index.html", nIndexHTML))
g.Add(gentronics.NewFile("templates/application.html", nApplicationHTML))
g.Add(gentronics.NewFile("assets/application.js", ""))
g.Add(gentronics.NewFile("assets/application.css", nApplicationCSS))
g.Add(gentronics.NewFile("assets/js/application.js", ""))
g.Add(gentronics.NewFile("assets/css/application.css", nApplicationCSS))
g.Add(gentronics.NewFile(".gitignore", nGitignore))
g.Add(gentronics.NewCommand(goGet("github.com/markbates/refresh/...")))
g.Add(gentronics.NewCommand(goInstall("github.com/markbates/refresh")))
Expand Down Expand Up @@ -165,21 +165,21 @@ const nApplicationHTML = `<html>
<meta charset="utf-8">
<title>Buffalo - {{ .titleName }}</title>
{{if .withBootstrap -}}
<link rel="stylesheet" href="/assets/bootstrap.css" type="text/css" media="all" />
<link rel="stylesheet" href="/assets/css/bootstrap.css" type="text/css" media="all" />
{{end -}}
<link rel="stylesheet" href="/assets/application.css" type="text/css" media="all" />
<link rel="stylesheet" href="/assets/css/application.css" type="text/css" media="all" />
</head>
<body>
{{"{{"}} yield {{"}}"}}
{{if .withJQuery -}}
<script src="/assets/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="/assets/js/jquery.js" type="text/javascript" charset="utf-8"></script>
{{end -}}
{{if .withBootstrap -}}
<script src="/assets/bootstrap.js" type="text/javascript" charset="utf-8"></script>
<script src="/assets/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
{{end -}}
<script src="/assets/application.js" type="text/javascript" charset="utf-8"></script>
<script src="/assets/js/application.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
`
Expand Down
4 changes: 2 additions & 2 deletions buffalo/cmd/generate/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ func NewBootstrapGenerator() *gentronics.Generator {
}
g := gentronics.New()
jf := &gentronics.RemoteFile{
File: gentronics.NewFile(filepath.Join("assets", "bootstrap.css"), ""),
File: gentronics.NewFile(filepath.Join("assets", "css", "bootstrap.css"), ""),
}
jf.Should = should
jf.RemotePath = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
g.Add(jf)

jf = &gentronics.RemoteFile{
File: gentronics.NewFile(filepath.Join("assets", "bootstrap.js"), ""),
File: gentronics.NewFile(filepath.Join("assets", "js", "bootstrap.js"), ""),
}
jf.Should = should
jf.RemotePath = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/generate/bootswatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func NewBootswatchGenerator(theme string) (*gentronics.Generator, error) {
},
})
jf := &gentronics.RemoteFile{
File: gentronics.NewFile(filepath.Join("assets", "bootstrap.css"), ""),
File: gentronics.NewFile(filepath.Join("assets", "css", "bootstrap.css"), ""),
}
jf.RemotePath = fmt.Sprintf("https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/%s/bootstrap.min.css", theme)
g.Add(jf)
Expand Down
4 changes: 2 additions & 2 deletions buffalo/cmd/generate/jquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ func NewJQueryGenerator() *gentronics.Generator {

g := gentronics.New()
jf := &gentronics.RemoteFile{
File: gentronics.NewFile(filepath.Join("assets", "jquery.js"), ""),
File: gentronics.NewFile(filepath.Join("assets", "js", "jquery.js"), ""),
}
jf.Should = should
jf.RemotePath = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"
g.Add(jf)

jm := &gentronics.RemoteFile{
File: gentronics.NewFile(filepath.Join("assets", "jquery.map"), ""),
File: gentronics.NewFile(filepath.Join("assets", "js", "jquery.map"), ""),
}
jm.Should = should
jm.RemotePath = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.map"
Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/generate/railjs.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ https://github.com/rails/jquery-ujs`,
func NewRailsJSGenerator() *gentronics.Generator {
g := gentronics.New()
jf := &gentronics.RemoteFile{
File: gentronics.NewFile(filepath.Join("assets", "rails.js"), ""),
File: gentronics.NewFile(filepath.Join("assets", "js", "rails.js"), ""),
}
jf.RemotePath = "https://raw.githubusercontent.com/rails/jquery-ujs/master/src/rails.js"
g.Add(jf)
Expand Down

0 comments on commit 2748fe5

Please sign in to comment.