tailwindcss.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. module Docs
  2. class Tailwindcss < UrlScraper
  3. self.name = 'Tailwind CSS'
  4. self.type = 'tailwindcss'
  5. self.slug = 'tailwindcss'
  6. self.base_url = 'https://tailwindcss.com/docs'
  7. self.root_path = '/'
  8. self.release = '2.0.3'
  9. html_filters.push 'tailwindcss/entries', 'tailwindcss/clean_html'
  10. # options[:container] = 'body';
  11. options[:skip_patterns] = [
  12. # removed because it focuses on how to use Tailwind with some other niche
  13. # technologies and to also align with DevDoc's Vision, which is" to:"
  14. # "indexing only the minimum useful to most developers" that use Tailwind
  15. %r{\/guides\/.*},
  16. # removed so it is easy to "get_type" (see tailwindcss/entries.rb line #15)
  17. %r{\/colors\z}
  18. options[:skip_patterns] = [
  19. # Skip setup instructions
  20. /\/browser-support$/,
  21. /\/editor-setup$/,
  22. /\/installation$/,
  23. /\/optimizing-for-production$/,
  24. /\/upgrade-guide/,
  25. /\/using-with-preprocessors/
  26. ]
  27. #Obtainable from https://github.com/tailwindlabs/tailwindcss/blob/master/LICENSE
  28. options[:attribution] = <<-HTML
  29. &copy; Adam Wathan, Jonathan Reinink
  30. Licensed under the MIT License.
  31. HTML
  32. def get_latest_version(opts)
  33. doc = fetch_doc('https://tailwindcss.com/docs/installation', opts)
  34. doc.at_css('select option[value=v2]').inner_text[1..]
  35. end
  36. end
  37. end