Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add styles #6

Closed
bitplanets opened this issue Dec 2, 2014 · 6 comments
Closed

How to add styles #6

bitplanets opened this issue Dec 2, 2014 · 6 comments

Comments

@bitplanets
Copy link

  module: {
    loaders: [
        {
            test: /\.scss$/,
            loader: ExtractTextPlugin.extract("style", "css!sass")
        },


plugins: [
    new ExtractTextPlugin("style.[hash].css", {
        allChunks: true
    }),
    new HtmlWebpackPlugin({
        template: 'src/client/index.html',
        "assets": {
            "client" : "client.[hash].js",
            "style"  : "style.[hash].css",
        }
    })
]

template:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <title>My App</title>
  </head>
  <body>
    <link href="{%=o.htmlWebpackPlugin.assets.style%}" media="all" rel="stylesheet" type="text/css">
    <script src="{%=o.htmlWebpackPlugin.assets.client%}"></script>
  </body>
</html>
@mateatslc
Copy link
Contributor

try:

<link rel="stylesheet" href="[prepend_your_public_path/]{%=o.webpack.assetsByChunkName.client[1]%}">

more details here: #1

@ampedandwired
Copy link
Collaborator

Thanks @bitplanets, some good ideas there, and apologies for not getting back to you sooner. I'm going to put a bit of work into making this a bit easier, as well as addressing the script ordering problem.

@jantimon
Copy link
Owner

The pull-request #14 supports the ExtractTextPlugin

@ampedandwired
Copy link
Collaborator

@jantimon's PR #14 allows for styles to be included, so closing this for now. Let me know if this doesn't meet your needs.

@IronSean
Copy link

I think this could use some more explicit documentation. Especially in the use case of multiple chunks going to the the head and/or body.

@lock
Copy link

lock bot commented May 31, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants