Add webpack 2 documentation
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 138 KiB |
|
@ -590,10 +590,10 @@ credits = [
|
||||||
'MIT',
|
'MIT',
|
||||||
'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
|
'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
|
||||||
], [
|
], [
|
||||||
'Webpack',
|
'webpack',
|
||||||
'2012-2016 Tobias Koppers',
|
'2012-2016 Tobias Koppers',
|
||||||
'MIT',
|
'CC BY',
|
||||||
'https://raw.githubusercontent.com/webpack/webpack/master/LICENSE'
|
'https://creativecommons.org/licenses/by/4.0/'
|
||||||
], [
|
], [
|
||||||
'Yarn',
|
'Yarn',
|
||||||
'2016-2017 Yarn Contributors',
|
'2016-2017 Yarn Contributors',
|
||||||
|
|
|
@ -92,5 +92,6 @@
|
||||||
'pages/underscore',
|
'pages/underscore',
|
||||||
'pages/vagrant',
|
'pages/vagrant',
|
||||||
'pages/vue',
|
'pages/vue',
|
||||||
|
'pages/webpack',
|
||||||
'pages/yard',
|
'pages/yard',
|
||||||
'pages/yii';
|
'pages/yii';
|
||||||
|
|
|
@ -92,5 +92,6 @@
|
||||||
'pages/underscore',
|
'pages/underscore',
|
||||||
'pages/vagrant',
|
'pages/vagrant',
|
||||||
'pages/vue',
|
'pages/vue',
|
||||||
|
'pages/webpack',
|
||||||
'pages/yard',
|
'pages/yard',
|
||||||
'pages/yii';
|
'pages/yii';
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
._icon-npm:before { background-position: -8rem -7rem; }
|
._icon-npm:before { background-position: -8rem -7rem; }
|
||||||
._icon-apache_http_server:before { background-position: -9rem -7rem; }
|
._icon-apache_http_server:before { background-position: -9rem -7rem; }
|
||||||
._icon-drupal:before { background-position: 0 -8rem; }
|
._icon-drupal:before { background-position: 0 -8rem; }
|
||||||
._icon-webpack:before { background-position: -1rem -8rem; @extend %darkIconFix !optional; }
|
._icon-webpack:before { background-position: -1rem -8rem; }
|
||||||
._icon-phaser:before { background-position: -2rem -8rem; }
|
._icon-phaser:before { background-position: -2rem -8rem; }
|
||||||
._icon-vue:before { background-position: -3rem -8rem; }
|
._icon-vue:before { background-position: -3rem -8rem; }
|
||||||
._icon-opentsdb:before { background-position: -4rem -8rem; }
|
._icon-opentsdb:before { background-position: -4rem -8rem; }
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
h1, h2, h3 { margin-left: 0; }
|
h1, h2, h3 { margin-left: 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
p > code, li > code, td > code { @extend %label; }
|
p > code, li > code, td > code, blockquote > code { @extend %label; }
|
||||||
blockquote { @extend %note; }
|
blockquote { @extend %note; }
|
||||||
blockquote > h4, blockquote > h5 { margin-top: .25rem; }
|
blockquote > h4, blockquote > h5 { margin-top: .25rem; }
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@
|
||||||
._redux,
|
._redux,
|
||||||
._sinon,
|
._sinon,
|
||||||
._typescript,
|
._typescript,
|
||||||
._webpack,
|
|
||||||
._yarn {
|
._yarn {
|
||||||
@extend %simple;
|
@extend %simple;
|
||||||
}
|
}
|
||||||
|
|
5
assets/stylesheets/pages/_webpack.scss
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
._webpack {
|
||||||
|
@extend %simple;
|
||||||
|
|
||||||
|
blockquote.tip { @extend %note-blue; }
|
||||||
|
}
|
|
@ -2,38 +2,40 @@ module Docs
|
||||||
class Webpack
|
class Webpack
|
||||||
class CleanHtmlFilter < Filter
|
class CleanHtmlFilter < Filter
|
||||||
def call
|
def call
|
||||||
root_page? ? root : other
|
@doc = at_css('.page__content')
|
||||||
|
|
||||||
|
at_css('h1').content = 'webpack' if root_page?
|
||||||
|
|
||||||
|
css('h3').each do |node|
|
||||||
|
node.name = 'h2'
|
||||||
|
end unless at_css('h2')
|
||||||
|
|
||||||
|
css('.anchor[id]').each do |node|
|
||||||
|
node.parent['id'] = node['id']
|
||||||
|
node.remove
|
||||||
|
end
|
||||||
|
|
||||||
|
css('hr', '.page__edit', 'hr + h3:contains("Contributors")', 'hr + h2:contains("Contributors")',
|
||||||
|
'.contributors', '.icon-link', '#maintainers.header', '#maintainers.header + table',
|
||||||
|
'#maintainer.header', '#maintainer.header + table').remove
|
||||||
|
|
||||||
|
css('> div', '.tip-content', '.header span').each do |node|
|
||||||
|
node.before(node.children).remove
|
||||||
|
end
|
||||||
|
|
||||||
|
css('> h1:first-child + h1').remove
|
||||||
|
|
||||||
|
css('.code-details-summary-span').each do |node|
|
||||||
|
node.content = node.content.remove(' (click to show)')
|
||||||
|
end
|
||||||
|
|
||||||
|
css('pre > code').each do |node|
|
||||||
|
node.parent['data-language'] = node['class'][/lang-(\w+)/, 1].sub('jsx', 'js') if node['class']
|
||||||
|
node.parent.content = node.parent.content
|
||||||
|
end
|
||||||
|
|
||||||
doc
|
doc
|
||||||
end
|
end
|
||||||
|
|
||||||
def root
|
|
||||||
@doc = at_css(".container > .row > .col-md-9")
|
|
||||||
|
|
||||||
# Remove all introdcution before the hr,
|
|
||||||
# The introduction about the documentation site which isn't relevant
|
|
||||||
# in devdocs.
|
|
||||||
hr_index = doc.children.find_index { |node| node.name == "hr" }
|
|
||||||
doc.children[0..hr_index].each(&:remove)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def other
|
|
||||||
css('h1, h2, h3, h4').each do |node|
|
|
||||||
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
|
|
||||||
end
|
|
||||||
|
|
||||||
# Re-create the header element
|
|
||||||
at_css("#wiki").child.before("<h1>#{at_css("#wikititle").content.titleize}</h1>")
|
|
||||||
|
|
||||||
@doc = at_css("#wiki")
|
|
||||||
|
|
||||||
css('.contents', 'a.anchor', 'hr').remove
|
|
||||||
|
|
||||||
css('pre').each do |node|
|
|
||||||
node.content = node.content
|
|
||||||
node['data-language'] = 'javascript'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
39
lib/docs/filters/webpack/clean_html_old.rb
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
module Docs
|
||||||
|
class Webpack
|
||||||
|
class CleanHtmlOldFilter < Filter
|
||||||
|
def call
|
||||||
|
root_page? ? root : other
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
|
||||||
|
def root
|
||||||
|
@doc = at_css(".container > .row > .col-md-9")
|
||||||
|
|
||||||
|
# Remove all introdcution before the hr,
|
||||||
|
# The introduction about the documentation site which isn't relevant
|
||||||
|
# in devdocs.
|
||||||
|
hr_index = doc.children.find_index { |node| node.name == "hr" }
|
||||||
|
doc.children[0..hr_index].each(&:remove)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def other
|
||||||
|
css('h1, h2, h3, h4').each do |node|
|
||||||
|
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
|
||||||
|
end
|
||||||
|
|
||||||
|
# Re-create the header element
|
||||||
|
at_css("#wiki").child.before("<h1>#{at_css("#wikititle").content.titleize}</h1>")
|
||||||
|
|
||||||
|
@doc = at_css("#wiki")
|
||||||
|
|
||||||
|
css('.contents', 'a.anchor', 'hr').remove
|
||||||
|
|
||||||
|
css('pre').each do |node|
|
||||||
|
node.content = node.content
|
||||||
|
node['data-language'] = 'javascript'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -2,28 +2,38 @@ module Docs
|
||||||
class Webpack
|
class Webpack
|
||||||
class EntriesFilter < Docs::EntriesFilter
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
def get_name
|
def get_name
|
||||||
entry_link.content
|
name = at_css('h1').content
|
||||||
|
name.sub! ' - ', ': '
|
||||||
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
TYPE_BY_DIRECTORY = {
|
||||||
|
'get-started' => 'Getting Started',
|
||||||
|
'concepts' => 'Concepts',
|
||||||
|
'guides' => 'Guides',
|
||||||
|
'api' => 'API',
|
||||||
|
'configuration' => 'Configuration',
|
||||||
|
'loaders' => 'Loaders',
|
||||||
|
'plugins' => 'Plugins'
|
||||||
|
}
|
||||||
|
|
||||||
def get_type
|
def get_type
|
||||||
link_li = entry_link.parent
|
TYPE_BY_DIRECTORY[slug.split('/').first]
|
||||||
type_links_list = link_li.parent
|
|
||||||
current_type = type_links_list.parent
|
|
||||||
|
|
||||||
# current type is a
|
|
||||||
# <li>
|
|
||||||
# TYPE
|
|
||||||
# <li> <ul> .. links .. </ul> </li>
|
|
||||||
# </li>
|
|
||||||
#
|
|
||||||
# Grab the first children (which is the text nodes whose contains the type)
|
|
||||||
current_type.children.first.content.strip.titleize
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
def additional_entries
|
||||||
|
if slug.start_with?('configuration')
|
||||||
def entry_link
|
css('h2[id] code').map do |node|
|
||||||
at_css("a[href='#{self.path}']")
|
[node.content, node.parent['id']]
|
||||||
|
end
|
||||||
|
elsif slug.start_with?('api')
|
||||||
|
css('.header[id] code').each_with_object [] do |node, entries|
|
||||||
|
next if node.previous.try(:content).present?
|
||||||
|
entries << ["#{self.name}: #{node.content.sub(/\(.*\)/, '()')}", node.parent['id']]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
31
lib/docs/filters/webpack/entries_old.rb
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
module Docs
|
||||||
|
class Webpack
|
||||||
|
class EntriesOldFilter < Docs::EntriesFilter
|
||||||
|
def get_name
|
||||||
|
entry_link.content
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_type
|
||||||
|
link_li = entry_link.parent
|
||||||
|
type_links_list = link_li.parent
|
||||||
|
current_type = type_links_list.parent
|
||||||
|
|
||||||
|
# current type is a
|
||||||
|
# <li>
|
||||||
|
# TYPE
|
||||||
|
# <li> <ul> .. links .. </ul> </li>
|
||||||
|
# </li>
|
||||||
|
#
|
||||||
|
# Grab the first children (which is the text nodes whose contains the type)
|
||||||
|
current_type.children.first.content.strip.titleize
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def entry_link
|
||||||
|
at_css("a[href='#{self.path}']")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -2,23 +2,72 @@ module Docs
|
||||||
class Webpack < UrlScraper
|
class Webpack < UrlScraper
|
||||||
self.name = 'webpack'
|
self.name = 'webpack'
|
||||||
self.type = 'webpack'
|
self.type = 'webpack'
|
||||||
self.release = '1.13.2'
|
|
||||||
self.base_url = 'https://webpack.github.io/docs/'
|
|
||||||
self.links = {
|
|
||||||
home: 'https://webpack.github.io/',
|
|
||||||
code: 'https://github.com/webpack/webpack'
|
|
||||||
}
|
|
||||||
|
|
||||||
html_filters.push 'webpack/entries', 'webpack/clean_html', 'title'
|
version '2' do
|
||||||
|
self.release = '2.2.0'
|
||||||
|
self.base_url = 'https://webpack.js.org/'
|
||||||
|
self.root_path = 'get-started/'
|
||||||
|
self.initial_paths = %w(
|
||||||
|
concepts/
|
||||||
|
guides/
|
||||||
|
api/
|
||||||
|
configuration/
|
||||||
|
loaders/
|
||||||
|
plugins/
|
||||||
|
)
|
||||||
|
self.links = {
|
||||||
|
home: 'https://webpack.js.org/',
|
||||||
|
code: 'https://github.com/webpack/webpack'
|
||||||
|
}
|
||||||
|
|
||||||
options[:title] = false
|
html_filters.push 'webpack/clean_html', 'webpack/entries'
|
||||||
options[:root_title] = 'webpack'
|
|
||||||
|
|
||||||
options[:skip] = %w(list-of-tutorials.html examples.html changelog.html ideas.html roadmap.html)
|
options[:container] = '.page'
|
||||||
|
options[:trailing_slash] = true
|
||||||
|
options[:only_patterns] = [
|
||||||
|
/\Aget-started\//,
|
||||||
|
/\Aconcepts\//,
|
||||||
|
/\Aguides\//,
|
||||||
|
/\Aapi\//,
|
||||||
|
/\Aconfiguration\//,
|
||||||
|
/\Aloaders\//,
|
||||||
|
/\Aplugins\//
|
||||||
|
]
|
||||||
|
|
||||||
options[:attribution] = <<-HTML
|
options[:attribution] = <<-HTML
|
||||||
© 2012–2016 Tobias Koppers<br>
|
© 2012–2016 Tobias Koppers<br>
|
||||||
Licensed under the MIT License.
|
Licensed under the Creative Commons Attribution License 4.0.
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
|
([self.root_path] + self.initial_paths).each do |path|
|
||||||
|
stub(path) do
|
||||||
|
capybara = load_capybara_selenium
|
||||||
|
capybara.app_host = self.base_url.origin
|
||||||
|
capybara.visit("#{self.base_url}#{path}")
|
||||||
|
capybara.execute_script('return document.body.innerHTML')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
version '1' do
|
||||||
|
self.release = '1.13.2'
|
||||||
|
self.base_url = 'https://webpack.github.io/docs/'
|
||||||
|
self.links = {
|
||||||
|
home: 'https://webpack.github.io/',
|
||||||
|
code: 'https://github.com/webpack/webpack'
|
||||||
|
}
|
||||||
|
|
||||||
|
html_filters.push 'webpack/entries_old', 'webpack/clean_html_old', 'title'
|
||||||
|
|
||||||
|
options[:title] = false
|
||||||
|
options[:root_title] = 'webpack'
|
||||||
|
|
||||||
|
options[:skip] = %w(list-of-tutorials.html examples.html changelog.html ideas.html roadmap.html)
|
||||||
|
|
||||||
|
options[:attribution] = <<-HTML
|
||||||
|
© 2012–2016 Tobias Koppers<br>
|
||||||
|
Licensed under the MIT License.
|
||||||
|
HTML
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Before Width: | Height: | Size: 579 B After Width: | Height: | Size: 669 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
1
public/icons/docs/webpack/SOURCE
Normal file
|
@ -0,0 +1 @@
|
||||||
|
https://github.com/webpack/media
|