ref: c5f1031e45f74e649a270359da2a3436e515c346
parent: 141f3e19e0a9ba873b0cece6071b1187daa81d8d
author: spf13 <[email protected]>
date: Sat Nov 1 08:05:37 EDT 2014
Handler WIP
--- a/hugolib/handler_file.go
+++ b/hugolib/handler_file.go
@@ -13,11 +13,23 @@
package hugolib
-import "github.com/spf13/hugo/source"
+import (
+ "fmt"
+ _ "github.com/dchest/cssmin"
+ "github.com/spf13/hugo/source"
+)
-var Filer interface {
- Read(*source.File)
- Render()
- Convert()
- Extensions() []string
+func init() {
+ RegisterHandler(css)
+}
+
+var css = Handle{
+ extensions: []string{"css"},
+ read: func(f *source.File, s *Site, results HandleResults) {
+ results <- HandledResult{file: f}
+ },
+ fileConvert: func(f *source.File, s *Site, results HandleResults) {
+
+ fmt.Println(f.Path())
+ },
}
--- a/hugolib/handler_page.go
+++ b/hugolib/handler_page.go
@@ -15,11 +15,8 @@
import "github.com/spf13/hugo/source"
-var Pager interface {
- Read(*source.File)
- Render()
- Convert()
- Extensions() []string
+func init() {
+ RegisterHandler(markdown)
}
var markdown = Handle{
@@ -48,8 +45,4 @@
results <- HandledResult{err: err}
},
-}
-
-func init() {
- RegisterHandler(markdown)
}
--- a/hugolib/handlers.go
+++ b/hugolib/handlers.go
@@ -16,9 +16,14 @@
import "github.com/spf13/hugo/source"
type Handler interface {
+ // Read the Files in and register
Read(*source.File, *Site, HandleResults)
- //Render()
+
+ // Convert Pages to prepare for templatizing
+ // Convert Files to their final destination
Convert(interface{}, *Site, HandleResults)
+
+ // Extensions to register the handle for
Extensions() []string
}