0

react-templates is a good solution to separate template and logic code,however,if i have multiply templates but referrer to one logic code,like i18n requests. eg.

post.js //which is the logic code
post.en.rt //which is the template for english
post.es.rt //for spanish

how to load in post.js?

PS: i don't wanna load all language templates in post.js,that would be a big file and it would be a waste for network

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
Kent Wood
  • 1,392
  • 2
  • 14
  • 30

1 Answers1

0

finaly,i use bundle loader with regexp to solove my question.

code like this

{ 
    test: /(en|cn)\.rt$/, 
    loaders: [
            "bundle?regExp=(en|cn)\.rt$&name=[1]",
            "react-templates-loader"
        ]
},

then all xxx.en.rt files will bundle into one en.js

Kent Wood
  • 1,392
  • 2
  • 14
  • 30