alexnoz/webpack-pug-scss-boilerplate

PUG pretty

Closed this issue · 6 comments

How to make PUG pretty: true on local test env?

I dont want html inline in test environment....

If I understand you correctly and your html is minified in development, then you can paste this line of code parts.loadPug({ pretty: true }) into the dev config. You can pass any options to Pug this way.

This what I want!! But, It's doesn't' work...

Error: options/query provided without loader (use loader + options) in {
"test": {},
"use": [
{
"loader": "html-loader"
},
{
"loader": "pug-html-loader"
}
],
"options": {
"pretty": true
}
}
at Function.normalizeRule (W:\code_test\kepical_teste\node_modules\webpack\lib\RuleSet.js:179:10)
at rules.map (W:\code_test\kepical_teste\node_modules\webpack\lib\RuleSet.js:86:20)
at Array.map ()
at Function.normalizeRules (W:\code_test\kepical_teste\node_modules\webpack\lib\RuleSet.js:85:17)
at new RuleSet (W:\code_test\kepical_teste\node_modules\webpack\lib\RuleSet.js:80:24)
at new NormalModuleFactory (W:\code_test\kepical_teste\node_modules\webpack\lib\NormalModuleFactory.js:49:18)
at Compiler.createNormalModuleFactory (W:\code_test\kepical_teste\node_modules\webpack\lib\Compiler.js:480:31)

at Compiler.newCompilationParams (W:\code_test\kepical_teste\node_modules\webpack\lib\Compiler.js:493:30)
at Compiler.compile (W:\code_test\kepical_teste\node_modules\webpack\lib\Compiler.js:501:23)
at compiler.applyPluginsAsync.err (W:\code_test\kepical_teste\node_modules\webpack\lib\Compiler.js:82:18)
at next (W:\code_test\kepical_teste\node_modules\tapable\lib\Tapable.js:202:11)
at Compiler.compilerInvalid (W:\code_test\kepical_teste\node_modules\webpack-dev-middleware\lib\Shared.js:161:
  1. at next (W:\code_test\kepical_teste\node_modules\tapable\lib\Tapable.js:204:14)
    at Compiler.compiler.plugin (W:\code_test\kepical_teste\node_modules\webpack\lib\CachePlugin.js:32:5)
    at next (W:\code_test\kepical_teste\node_modules\tapable\lib\Tapable.js:204:14)
    at linterSuccess (W:\code_test\kepical_teste\node_modules\stylelint-webpack-plugin\lib\run-compilation.js:36:9
    )

I think I've figured it out. First, please, download the new version (1.1.2) of the boilerplate. Then, make the following changes to the webpack.config.js:

Everything should work now.

I download last version (1.1.2). And and I did the whole process again...
Error only when I put parts.loadPug({ pretty: true }) to dev config.

Failed to compile.

ERROR in ./app/index.pug
Module not found: Error: Can't resolve './""' in 'W:\code_test\webpack-pug-scss\app'
@ ./app/index.pug 1:406-425
@ ./app/scripts/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./app/scripts

ERROR in Error: Child compilation failed:
Module not found: Error: Can't resolve './""' in 'W:\code_test\webpack-pug-scss\app':
Error: Can't resolve './""' in 'W:\code_test\webpack-pug-scss\app'

  • compiler.js:76
    [webpack-pug-scss]/[html-webpack-plugin]/lib/compiler.js:76:16

  • Compiler.js:300 compile
    [webpack-pug-scss]/[webpack]/lib/Compiler.js:300:11

  • Compiler.js:510 applyPluginsAsync.err
    [webpack-pug-scss]/[webpack]/lib/Compiler.js:510:14

  • Tapable.js:202 next
    [webpack-pug-scss]/[tapable]/lib/Tapable.js:202:11

  • CachePlugin.js:78 Compiler.
    [webpack-pug-scss]/[webpack]/lib/CachePlugin.js:78:5

  • Tapable.js:206 Compiler.applyPluginsAsyncSeries
    [webpack-pug-scss]/[tapable]/lib/Tapable.js:206:13

  • Compiler.js:507 compilation.seal.err
    [webpack-pug-scss]/[webpack]/lib/Compiler.js:507:11

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [webpack-pug-scss]/[tapable]/lib/Tapable.js:195:46

  • Compilation.js:680 self.applyPluginsAsync.err
    [webpack-pug-scss]/[webpack]/lib/Compilation.js:680:19

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [webpack-pug-scss]/[tapable]/lib/Tapable.js:195:46

  • Compilation.js:671 self.applyPluginsAsync.err
    [webpack-pug-scss]/[webpack]/lib/Compilation.js:671:11

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [webpack-pug-scss]/[tapable]/lib/Tapable.js:195:46

  • Compilation.js:666 self.applyPluginsAsync.err
    [webpack-pug-scss]/[webpack]/lib/Compilation.js:666:10

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [webpack-pug-scss]/[tapable]/lib/Tapable.js:195:46

  • Compilation.js:662 sealPart2
    [webpack-pug-scss]/[webpack]/lib/Compilation.js:662:9

  • Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [webpack-pug-scss]/[tapable]/lib/Tapable.js:195:46

Make sure that you're actually moving this line to the production config and not copying it.

Closed due to lack of activity. Feel free to reopen if the issue is still relevant.