Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-04-28 15:02:41 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-04-29 11:51:33 +0300
commit6add6d77b48cf0aab8b39d7a2bddedb1aa2a52b8 (patch)
treec096c3421db8932e6d06eca533646c58b5ddaa93 /tpl
parent2a171ff1c5d9b1603fe78c67d2d894bb2efccc8b (diff)
Rename transpileJS to babel
And add a test. Updates #5764
Diffstat (limited to 'tpl')
-rw-r--r--tpl/resources/init.go4
-rw-r--r--tpl/resources/resources.go46
2 files changed, 25 insertions, 25 deletions
diff --git a/tpl/resources/init.go b/tpl/resources/init.go
index 10e8e5319..df83cb3bb 100644
--- a/tpl/resources/init.go
+++ b/tpl/resources/init.go
@@ -60,8 +60,8 @@ func init() {
[][2]string{},
)
- ns.AddMethodMapping(ctx.TranspileJS,
- []string{"transpileJS"},
+ ns.AddMethodMapping(ctx.Babel,
+ []string{"babel"},
[][2]string{},
)
diff --git a/tpl/resources/resources.go b/tpl/resources/resources.go
index c256fa903..6625702ab 100644
--- a/tpl/resources/resources.go
+++ b/tpl/resources/resources.go
@@ -29,12 +29,12 @@ import (
"github.com/gohugoio/hugo/resources/resource_factories/bundler"
"github.com/gohugoio/hugo/resources/resource_factories/create"
+ "github.com/gohugoio/hugo/resources/resource_transformers/babel"
"github.com/gohugoio/hugo/resources/resource_transformers/integrity"
"github.com/gohugoio/hugo/resources/resource_transformers/minifier"
"github.com/gohugoio/hugo/resources/resource_transformers/postcss"
"github.com/gohugoio/hugo/resources/resource_transformers/templates"
"github.com/gohugoio/hugo/resources/resource_transformers/tocss/scss"
- "github.com/gohugoio/hugo/resources/resource_transformers/transpilejs"
"github.com/spf13/cast"
)
@@ -55,15 +55,15 @@ func New(deps *deps.Deps) (*Namespace, error) {
}
return &Namespace{
- deps: deps,
- scssClient: scssClient,
- createClient: create.New(deps.ResourceSpec),
- bundlerClient: bundler.New(deps.ResourceSpec),
- integrityClient: integrity.New(deps.ResourceSpec),
- minifyClient: minifyClient,
- postcssClient: postcss.New(deps.ResourceSpec),
- templatesClient: templates.New(deps.ResourceSpec, deps),
- transpileJSClient: transpilejs.New(deps.ResourceSpec),
+ deps: deps,
+ scssClient: scssClient,
+ createClient: create.New(deps.ResourceSpec),
+ bundlerClient: bundler.New(deps.ResourceSpec),
+ integrityClient: integrity.New(deps.ResourceSpec),
+ minifyClient: minifyClient,
+ postcssClient: postcss.New(deps.ResourceSpec),
+ templatesClient: templates.New(deps.ResourceSpec, deps),
+ babelClient: babel.New(deps.ResourceSpec),
}, nil
}
@@ -71,14 +71,14 @@ func New(deps *deps.Deps) (*Namespace, error) {
type Namespace struct {
deps *deps.Deps
- createClient *create.Client
- bundlerClient *bundler.Client
- scssClient *scss.Client
- integrityClient *integrity.Client
- minifyClient *minifier.Client
- postcssClient *postcss.Client
- transpileJSClient *transpilejs.Client
- templatesClient *templates.Client
+ createClient *create.Client
+ bundlerClient *bundler.Client
+ scssClient *scss.Client
+ integrityClient *integrity.Client
+ minifyClient *minifier.Client
+ postcssClient *postcss.Client
+ babelClient *babel.Client
+ templatesClient *templates.Client
}
// Get locates the filename given in Hugo's assets filesystem
@@ -283,22 +283,22 @@ func (ns *Namespace) PostProcess(r resource.Resource) (postpub.PostPublishedReso
}
-// TranspileJS processes the given Resource with Babel.
-func (ns *Namespace) TranspileJS(args ...interface{}) (resource.Resource, error) {
+// Babel processes the given Resource with Babel.
+func (ns *Namespace) Babel(args ...interface{}) (resource.Resource, error) {
r, m, err := ns.resolveArgs(args)
if err != nil {
return nil, err
}
- var options transpilejs.Options
+ var options babel.Options
if m != nil {
- options, err = transpilejs.DecodeOptions(m)
+ options, err = babel.DecodeOptions(m)
if err != nil {
return nil, err
}
}
- return ns.transpileJSClient.Process(r, options)
+ return ns.babelClient.Process(r, options)
}