ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Daisy​UI Autocomplete

by etoundi2nd ALL

Sublime Text Package for DaisyUI autocompletion

Details

Installs

  • Total 295
  • Win 224
  • Mac 39
  • Linux 32
Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10
Windows 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 0 0 0 0 2 0 0 0 2 0 0 1 0 1 0 0
Mac 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
Linux 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

daisyui-autocomplete by etoundi.com

DaisyUI v.3.2.1 autocomplete for Sublime Text.

screenshot

Installation

# add the repository to the Sublime packages directory
cd ~/Library/Application\ Support/Sublime\ Text/Packages/
git clone git@github.com/etoundi2nd/daisyui-autocomplete.git

Contribution

If you want to contribute to the project

git clone git@github.com/etoundi2nd/daisyui-autocomplete.git

Note: getting a list of daisyui using ruby

Parse full css output (will includes all TailwindCSS classes)

# install gem
gem install css_parser

# then in irb
require 'css_parser'
include CssParser

url = 'https://cdn.jsdelivr.net/npm/daisyui@3.2.1/dist/full.css' # change version to the latest
parser = CssParser::Parser.new
parser.load_uri!(url)

classes_list = parser.to_h['all'].keys.filter_map do |key|
    next unless key.starts_with?('.')
    key.split(' ')[0]
       .split(':')[0]
       .strip
       .split('[')[0]
       .gsub('\\', '')
       .split('.')
       .reject(&:empty?)
end.flatten.uniq

puts classes_list

Web scrapping the documentation

gem install 'nokogiri' # parsing gem

require 'nokogiri'
require 'open-uri'
require 'net/http'

def get_document(path)
    path += '/' unless path.ends_with?('/')
    url = URI.join('https://daisyui.com', path).to_s
    uri = URI.parse(url)
    response = Net::HTTP.get_response(uri)
    html = response.body
    Nokogiri::HTML(html)
end

doc = get_document('/components/')
link_to_components = doc.css('body > div > div.bg-base-100.drawer.lg\:drawer-open > div.drawer-content > div.max-w-\[100vw\].px-6.pb-16.xl\:pr-2 > div > div.not-prose.grid.grid-cols-1.gap-x-6.gap-y-12.sm\:grid-cols-2.lg\:grid-cols-3 a.card')

classes_list = link_to_components.map do |link|
    path = link.attr('href')
    component_doc = get_document(path)
    class_name_doc = component_doc.css('body > div > div.bg-base-100.drawer.lg\\:drawer-open > div.drawer-content > div.max-w-\\[100vw\\].px-6.pb-16.xl\\:pr-2 > div > div.prose.prose-sm.md\\:prose-base.w-full.max-w-4xl.flex-grow.pt-10 > div.not-prose.relative.mb-10.mt-6.max-h-\\[25rem\\].overflow-x-auto > table > tbody > tr > th > span')

    puts "-- #{path}"
    sleep rand(0.2..1.5)

    class_name_doc.map { |span| span.text.strip }
end.flatten.uniq

puts classes_list

Credits

Created based on Tailwind CSS Autocomplete for Sublime Text ¾ by @danklammer