mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
Add Dart Sass support
But note that the Dart Sass Embedded Protocol is still in beta (beta 5), a main release scheduled for Q1 2021. Fixes #7380 Fixes #8102
This commit is contained in:
35
deps/deps.go
vendored
35
deps/deps.go
vendored
@@ -94,6 +94,9 @@ type Deps struct {
|
||||
// BuildStartListeners will be notified before a build starts.
|
||||
BuildStartListeners *Listeners
|
||||
|
||||
// Resources that gets closed when the build is done or the server shuts down.
|
||||
BuildClosers *Closers
|
||||
|
||||
// Atomic values set during a build.
|
||||
// This is common/global for all sites.
|
||||
BuildState *BuildState
|
||||
@@ -284,6 +287,7 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
Site: cfg.Site,
|
||||
FileCaches: fileCaches,
|
||||
BuildStartListeners: &Listeners{},
|
||||
BuildClosers: &Closers{},
|
||||
BuildState: buildState,
|
||||
Running: cfg.Running,
|
||||
Timeout: time.Duration(timeoutms) * time.Millisecond,
|
||||
@@ -297,6 +301,10 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
func (d *Deps) Close() error {
|
||||
return d.BuildClosers.Close()
|
||||
}
|
||||
|
||||
// ForLanguage creates a copy of the Deps with the language dependent
|
||||
// parts switched out.
|
||||
func (d Deps) ForLanguage(cfg DepsCfg, onCreated func(d *Deps) error) (*Deps, error) {
|
||||
@@ -399,3 +407,30 @@ func (b *BuildState) Incr() int {
|
||||
func NewBuildState() BuildState {
|
||||
return BuildState{}
|
||||
}
|
||||
|
||||
type Closer interface {
|
||||
Close() error
|
||||
}
|
||||
|
||||
type Closers struct {
|
||||
mu sync.Mutex
|
||||
cs []Closer
|
||||
}
|
||||
|
||||
func (cs *Closers) Add(c Closer) {
|
||||
cs.mu.Lock()
|
||||
defer cs.mu.Unlock()
|
||||
cs.cs = append(cs.cs, c)
|
||||
}
|
||||
|
||||
func (cs *Closers) Close() error {
|
||||
cs.mu.Lock()
|
||||
defer cs.mu.Unlock()
|
||||
for _, c := range cs.cs {
|
||||
c.Close()
|
||||
}
|
||||
|
||||
cs.cs = cs.cs[:0]
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user