Webpack Config - 将[hash]传递给加载程序数据

时间:2017-07-17 08:46:54

标签: node.js webpack pug

我使用pug-html-loader加载大量的pug模板并将它们转换为build目录中的html。这工作正常,但我希望能够在pug模板中插入webpack哈希。

我无法解决如何设置我的webpack.config以将此数据传递给pug-html-loader

这是我webpack.config中的加载器

public class CategoryItem {
   String id;
   String name;
   public CategoryItem(String id, String name) {
     this.id = id;
     this.name = name;
   }
   public String getId() {
     return id;
   }
   public String getName() {
     return name;
   }
}

正如您所看到的,我想在当前有for (int i = 0; i < categoryItems.size(); i++) { CategoryItem categoryItem = categoryItems.get(i); final String iCat = categoryItem.getId(); Observable<ProductResponse> call = networkManager.getApiServiceProductsRx().getProductsRx(iCat); Subscription subscription = call .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<ProductResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { if (e instanceof HttpException) { HttpException response = (HttpException) e; int code = response.code(); Log.d("RetrofitTest", "Error code: " + code); } } @Override public void onNext(ProductResponse response) { mProductItemsBelongingToACategory = new ArrayList<>(); mProductItemsBelongingToACategory = response.getProductChannel().getProductItems(); mDatabaseHandler.addProducts(iCat, mProductItemsBelongingToACategory); } }); subscriptions2.add(subscription); } 的数据对象中插入webpack哈希,但无法解决如何在webpack.config文件中访问/传递

0 个答案:

没有答案