This repository was archived by the owner on Mar 17, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 254
feat(index): add cssOutputPath option (option.cssOutputPath)
#150
Closed
Closed
Changes from 14 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
a92f630
fix: outputs from useRelativePath
adriancmiranda e15e3a4
fix: Allowing .travis.yml file in git
adriancmiranda 6c5f129
style: indentation
adriancmiranda 509855d
fix: outputs
adriancmiranda 1eb69cd
style: keeping only double quotes
adriancmiranda 7dbce89
fix: textOutputPath parameter validation
adriancmiranda ffe9709
fix: normalized outputPath sep in windows os
adriancmiranda f2ebd86
docs: textOutputPath parameter
adriancmiranda d3ddff5
docs: textOutputPath parameter
adriancmiranda 7cf4921
docs: textOutputPath parameter
adriancmiranda 74c9e98
style: keeping only double quotes
adriancmiranda 5c4d2a4
fix: public path from js files
adriancmiranda bdbb0e2
style: identation to tabs
adriancmiranda 39b66b2
chore: removed vendor references
adriancmiranda 4d1a43c
chore: changing textOutputPath to cssOutputPath
adriancmiranda 3dde284
docs: changing textOutputPath to cssOutputPath
adriancmiranda 584f009
fix: cssOutputPath defaults
adriancmiranda 41516e5
fix: script path validation
adriancmiranda 7b9ee2c
fix: cssOutputPath default validation
adriancmiranda 02983bf
fix: type validation is needed to empty values
adriancmiranda 23dffad
fix: typo
adriancmiranda 9c62249
Merge branch 'master' into master
adriancmiranda 17e608b
Merge branch 'master' into master
adriancmiranda 564e84d
Merge branch 'master' of https://github.com/adriancmiranda/file-loader
adriancmiranda 788a189
refactor: removes support for older node version
adriancmiranda 02c8e32
refactor: strict mode
adriancmiranda f190ee5
docs: adding examples folder
adriancmiranda 298a059
docs: sample improvement
adriancmiranda 68ac897
doc: sample with dev mode
adriancmiranda db0596c
docs: sample with asset request from html
adriancmiranda 1a0be65
docs: sample build fixed up
adriancmiranda 6ea9f7e
docs: sample build fixed up
adriancmiranda 26077c7
docs: added examples builder
adriancmiranda 3bf2dac
test: examples compilation
adriancmiranda 7fc4bd2
test: reporter
adriancmiranda c66447b
test: _module.issuer.context mockup
adriancmiranda 3d136e3
test: webpack config mock-up
adriancmiranda 57786c9
docs: update samples
adriancmiranda 8e511d7
chore: recovering the file-loader icon
adriancmiranda 8ff353f
test: cssOutputPath option
adriancmiranda 60e3aa3
fix: output dirname rule should accept urls like ../foo/../bar
adriancmiranda e4b006e
fix: default publicPath
adriancmiranda 1cf0f71
fix: default publicPath
adriancmiranda 1cf6f67
Merge branch 'master' into master
adriancmiranda bf65289
feat: add option.cssOutputPath
adriancmiranda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ | |
|
|
||
| # dotfiles | ||
| .* | ||
| !.editorconfig | ||
| !.gitignore | ||
| !.travis.yml | ||
| *~ | ||
| *#* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,25 +36,49 @@ module.exports = function(content) { | |
| }); | ||
|
|
||
| var outputPath = ""; | ||
|
|
||
| var filePath = this.resourcePath; | ||
| if (config.useRelativePath) { | ||
| var issuerContext = this._module && this._module.issuer && this._module.issuer.context || context; | ||
| var relativeUrl = issuerContext && path.relative(issuerContext, filePath).split(path.sep).join("/"); | ||
| var relativePath = relativeUrl && path.dirname(relativeUrl) + "/"; | ||
| if (~relativePath.indexOf("../")) { | ||
| outputPath = path.posix.join(outputPath, relativePath, url); | ||
| } else { | ||
| outputPath = relativePath + url; | ||
| } | ||
| url = relativePath + url; | ||
| } else if (config.outputPath) { | ||
| if (config.outputPath) { | ||
| // support functions as outputPath to generate them dynamically | ||
| outputPath = ( | ||
| typeof config.outputPath === "function" | ||
| ? config.outputPath(url) | ||
| : config.outputPath + url | ||
| ); | ||
| } | ||
|
|
||
| if (config.useRelativePath) { | ||
| // Only the dirname is needed in this case. | ||
| outputPath = outputPath.replace(url, ""); | ||
|
|
||
| // We have access only to entry point relationships. So we work with this relations. | ||
| var issuerContext = (this._module && this._module.issuer && this._module.issuer.context) || context; | ||
| var relativeUrl = issuerContext && path.relative(issuerContext, this.resourcePath); | ||
| var relativePath = relativeUrl && path.dirname(relativeUrl); | ||
| var outputDirname = relativePath.replace(/\.\.(\/|\\)/g, "").split(path.sep).join("/"); | ||
|
|
||
| // Output path | ||
| // If the `outputDirname` is pointing to up in relation to the `outputPath`. | ||
| // We forced him to the webpack output path config. Even though it is empty. | ||
| if (outputDirname.indexOf(outputPath) !== 0) { | ||
| outputDirname = outputPath; | ||
| } | ||
| outputPath = path.join(outputDirname, url).split(path.sep).join("/"); | ||
|
|
||
| // Public path | ||
| // Entry files doesn't pass through the `file-loader`. | ||
| // So we don't have access to the files context to compare with your assets context | ||
| // then we need to create and the same way force the `relativePath` to bundled files | ||
| // on the webpack output path config folder and manually the same with CSS file. | ||
| var output = this.options.output || {}; | ||
| if (output.filename && path.extname(output.filename) === ".js") { | ||
|
||
| relativePath = outputDirname; | ||
| } else if (toString.call(config.textOutputPath) === "[object String]") { | ||
| var outputPackageDirname = output.path.replace(this.options.context + path.sep, ""); | ||
| var issuerOutput = path.join(context, outputPackageDirname, config.textOutputPath); | ||
| var assetOutput = path.join(context, outputPackageDirname, outputDirname); | ||
| relativePath = path.relative(issuerOutput, assetOutput); | ||
| } | ||
| url = path.join(relativePath, url).split(path.sep).join("/"); | ||
| } else if (config.outputPath) { | ||
| url = outputPath; | ||
| } else { | ||
| outputPath = url; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why to change these two?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep these will be taken care of by #130
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ignored all dotfiles in my last commit, but I forgot to allow .travis.yml too, not only the .gitignore.
About the .editorconfig it was my carelessness shouldn't be there yet (what to led change formatting), I've been working on another machine and it would configure wrong. Sorry!