3

I'm working on a little multi-page application based on Vue.js CLI 3 and Spring boot for the backend.

I read the official doc to build a multi page, so my vue.config.js looks like:

module.exports = {
    outputDir: 'target/dist',
    pages: {
        home: {
            entry: 'src/home/home.js',
            template: 'src/home/home.html',
            filename: 'home.js'
        },
        otherPage: {...}
    }
}

Everything works fine, until I add some Thymeleaf syntax in my templates (e.g. with placholders ${text}). The build fails because of the ${} placeholders which are not resolved (I don't know which loader or plugin try to resolve thoses placeholders, I use the standard vue-cli webpack project structure..).

Is there a way to configure webpack in order to ignore the Thymeleaf syntax and to not trying to resolve thoses placeholders?

1
  • use html-loader. But it won't be enough. Also filename is the destination path. So it should be html Commented Oct 10, 2018 at 14:26

1 Answer 1

1

I replaced $ by <%="$"%> as workaround.

But it's not work for <script></script>

<script>
    var user = <%="$"%>{user};
</script>

Then I found solution

<script th:inline="javascript">
/*<![CDATA[*/
    var user = /*[[<%="$"%>{user}]]*/ 'default';
/*]]>*/
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.