frontsau 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bin/frontsau +15 -0
- data/bin/frontsau-phaml-compiler +35 -0
- data/example/.frontsau +12 -0
- data/example/assets/head.jpg +0 -0
- data/example/assets/script.js +4 -0
- data/example/assets/style.css +6 -0
- data/example/css/includes.sass +2 -0
- data/example/css/style.sass +6 -0
- data/example/image/head.jpg +0 -0
- data/example/index.html +0 -0
- data/example/js/script.coffee +1 -0
- data/frontsau.gemspec +41 -0
- data/lib/Phamlp/Phamlp.php +72 -0
- data/lib/Phamlp/PhamlpException.php +31 -0
- data/lib/Phamlp/haml/HamlException.php +29 -0
- data/lib/Phamlp/haml/HamlHelpers.php +199 -0
- data/lib/Phamlp/haml/HamlParser.php +1250 -0
- data/lib/Phamlp/haml/filters/HamlBaseFilter.php +30 -0
- data/lib/Phamlp/haml/filters/HamlCdataFilter.php +29 -0
- data/lib/Phamlp/haml/filters/HamlCssFilter.php +30 -0
- data/lib/Phamlp/haml/filters/HamlEscapedFilter.php +32 -0
- data/lib/Phamlp/haml/filters/HamlJavascriptFilter.php +31 -0
- data/lib/Phamlp/haml/filters/HamlPhpFilter.php +27 -0
- data/lib/Phamlp/haml/filters/HamlPlainFilter.php +28 -0
- data/lib/Phamlp/haml/filters/HamlPreserveFilter.php +29 -0
- data/lib/Phamlp/haml/filters/HamlSassFilter.php +37 -0
- data/lib/Phamlp/haml/filters/HamlScssFilter.php +37 -0
- data/lib/Phamlp/haml/filters/_HamlMarkdownFilter.php +50 -0
- data/lib/Phamlp/haml/filters/_HamlTextileFilter.php +50 -0
- data/lib/Phamlp/haml/messages/_i18n.php +32 -0
- data/lib/Phamlp/haml/messages/de.php +32 -0
- data/lib/Phamlp/haml/messages/fr.php +32 -0
- data/lib/Phamlp/haml/renderers/HamlCompactRenderer.php +32 -0
- data/lib/Phamlp/haml/renderers/HamlCompressedRenderer.php +48 -0
- data/lib/Phamlp/haml/renderers/HamlExpandedRenderer.php +58 -0
- data/lib/Phamlp/haml/renderers/HamlNestedRenderer.php +77 -0
- data/lib/Phamlp/haml/renderers/HamlRenderer.php +137 -0
- data/lib/Phamlp/haml/tree/HamlCodeBlockNode.php +58 -0
- data/lib/Phamlp/haml/tree/HamlCommentNode.php +41 -0
- data/lib/Phamlp/haml/tree/HamlDoctypeNode.php +27 -0
- data/lib/Phamlp/haml/tree/HamlElementNode.php +52 -0
- data/lib/Phamlp/haml/tree/HamlFilterNode.php +50 -0
- data/lib/Phamlp/haml/tree/HamlHelperNode.php +73 -0
- data/lib/Phamlp/haml/tree/HamlNode.php +253 -0
- data/lib/Phamlp/haml/tree/HamlNodeExceptions.php +19 -0
- data/lib/Phamlp/haml/tree/HamlRootNode.php +58 -0
- data/lib/Phamlp/sass/SassException.php +29 -0
- data/lib/Phamlp/sass/SassFile.php +164 -0
- data/lib/Phamlp/sass/SassParser.php +848 -0
- data/lib/Phamlp/sass/extensions/compass/config.php +65 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/_blueprint.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +101 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_colors.scss +32 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_debug.scss +11 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +86 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_form.scss +68 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_grid.scss +249 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_ie.scss +109 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +57 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +37 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +147 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_print.scss +93 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +54 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_typography.scss +104 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +37 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +58 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/ie.sass +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/manifest.rb +30 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/partials/_base.sass +10 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/print.sass +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/screen.sass +12 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons.sass +49 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/manifest.rb +17 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons.sass +13 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/manifest.rb +23 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/ie.sass +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/manifest.rb +30 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/print.sass +8 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/screen.sass +45 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/ie.sass +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/manifest.rb +33 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_base.sass +10 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_form.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_page.sass +18 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_two_col.sass +38 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/print.sass +5 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/screen.sass +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/_compass.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_css3.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_layout.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_utilities.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +43 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +42 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-size.scss +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +135 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +50 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +13 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box.scss +112 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_columns.scss +55 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_font-face.scss +33 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_gradient.scss +82 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +12 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_opacity.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_shared.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_transform.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_transition.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/reset/_utilities.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_general.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_links.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_lists.scss +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_print.scss +17 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_tables.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_text.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss +31 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +35 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_min.scss +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss +5 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss +28 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +7 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +52 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +29 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +56 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +20 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/ellipsis.sass +9 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/manifest.rb +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/manifest.rb +20 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/stylesheets/main.sass +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/templates/project/manifest.rb +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/templates/project/screen.sass +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/USAGE.markdown +32 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/ie.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/manifest.rb +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/print.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/screen.sass +7 -0
- data/lib/Phamlp/sass/extensions/compass/functions/colourStops.php +268 -0
- data/lib/Phamlp/sass/extensions/compass/functions/constants.php +44 -0
- data/lib/Phamlp/sass/extensions/compass/functions/fontFiles.php +30 -0
- data/lib/Phamlp/sass/extensions/compass/functions/imageSize.php +39 -0
- data/lib/Phamlp/sass/extensions/compass/functions/inlineData.php +84 -0
- data/lib/Phamlp/sass/extensions/compass/functions/lists.php +47 -0
- data/lib/Phamlp/sass/extensions/compass/functions/selectors.php +128 -0
- data/lib/Phamlp/sass/extensions/compass/functions/urls.php +143 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/_compass.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_css3.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_layout.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_utilities.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-clip.scss +43 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-origin.scss +42 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-size.scss +14 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_border-radius.scss +135 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box-shadow.scss +50 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box-sizing.scss +13 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box.scss +112 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_columns.scss +55 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_font-face.scss +33 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_gradient.scss +96 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_inline-block.scss +12 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_opacity.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_shared.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_text-shadow.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_transform.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_transition.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/reset/_utilities.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_general.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_links.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_lists.scss +4 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_print.scss +17 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_sprites.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_tables.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_text.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_clearfix.scss +31 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_hacks.scss +35 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_min.scss +16 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_reset.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_hover-link.scss +5 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_link-colors.scss +28 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +7 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_bullets.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +52 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_inline-list.scss +29 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +56 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +20 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_borders.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_ellipsis.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_nowrap.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_replacement.scss +34 -0
- data/lib/Phamlp/sass/messages/_i18n.php +122 -0
- data/lib/Phamlp/sass/messages/de.php +70 -0
- data/lib/Phamlp/sass/messages/fr.php +70 -0
- data/lib/Phamlp/sass/renderers/SassCompactRenderer.php +130 -0
- data/lib/Phamlp/sass/renderers/SassCompressedRenderer.php +102 -0
- data/lib/Phamlp/sass/renderers/SassExpandedRenderer.php +62 -0
- data/lib/Phamlp/sass/renderers/SassNestedRenderer.php +61 -0
- data/lib/Phamlp/sass/renderers/SassRenderer.php +51 -0
- data/lib/Phamlp/sass/script/SassScriptFunction.php +169 -0
- data/lib/Phamlp/sass/script/SassScriptFunctions.php +751 -0
- data/lib/Phamlp/sass/script/SassScriptLexer.php +114 -0
- data/lib/Phamlp/sass/script/SassScriptOperation.php +151 -0
- data/lib/Phamlp/sass/script/SassScriptParser.php +192 -0
- data/lib/Phamlp/sass/script/SassScriptParserExceptions.php +40 -0
- data/lib/Phamlp/sass/script/SassScriptVariable.php +57 -0
- data/lib/Phamlp/sass/script/literals/SassBoolean.php +67 -0
- data/lib/Phamlp/sass/script/literals/SassColour.php +886 -0
- data/lib/Phamlp/sass/script/literals/SassLiteral.php +359 -0
- data/lib/Phamlp/sass/script/literals/SassLiteralExceptions.php +47 -0
- data/lib/Phamlp/sass/script/literals/SassNumber.php +503 -0
- data/lib/Phamlp/sass/script/literals/SassString.php +106 -0
- data/lib/Phamlp/sass/tree/SassCommentNode.php +64 -0
- data/lib/Phamlp/sass/tree/SassContext.php +120 -0
- data/lib/Phamlp/sass/tree/SassDebugNode.php +84 -0
- data/lib/Phamlp/sass/tree/SassDirectiveNode.php +76 -0
- data/lib/Phamlp/sass/tree/SassElseNode.php +28 -0
- data/lib/Phamlp/sass/tree/SassExtendNode.php +47 -0
- data/lib/Phamlp/sass/tree/SassForNode.php +99 -0
- data/lib/Phamlp/sass/tree/SassIfNode.php +95 -0
- data/lib/Phamlp/sass/tree/SassImportNode.php +69 -0
- data/lib/Phamlp/sass/tree/SassMixinDefinitionNode.php +88 -0
- data/lib/Phamlp/sass/tree/SassMixinNode.php +91 -0
- data/lib/Phamlp/sass/tree/SassNode.php +342 -0
- data/lib/Phamlp/sass/tree/SassNodeExceptions.php +117 -0
- data/lib/Phamlp/sass/tree/SassPropertyNode.php +239 -0
- data/lib/Phamlp/sass/tree/SassRootNode.php +100 -0
- data/lib/Phamlp/sass/tree/SassRuleNode.php +337 -0
- data/lib/Phamlp/sass/tree/SassVariableNode.php +90 -0
- data/lib/Phamlp/sass/tree/SassWhileNode.php +64 -0
- data/lib/frontsau/assets/rack.rb +12 -0
- data/lib/frontsau/assets/sprockets.rb +59 -0
- data/lib/frontsau/assets/static_assets_compiler.rb +50 -0
- data/lib/frontsau/assets/url_rewriter.rb +22 -0
- data/lib/frontsau/assets/watcher.rb +60 -0
- data/lib/frontsau/thor_app.rb +118 -0
- data/lib/frontsau/version.rb +3 -0
- data/lib/frontsau.rb +64 -0
- metadata +578 -0
@@ -0,0 +1,253 @@
|
|
1
|
+
<?php
|
2
|
+
/* SVN FILE: $Id: HamlNode.php 92 2010-05-20 17:42:59Z chris.l.yates $ */
|
3
|
+
/**
|
4
|
+
* HamlNode class file.
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
8
|
+
* @package PHamlP
|
9
|
+
* @subpackage Haml.tree
|
10
|
+
*/
|
11
|
+
|
12
|
+
require_once('HamlRootNode.php');
|
13
|
+
require_once('HamlCommentNode.php');
|
14
|
+
require_once('HamlDoctypeNode.php');
|
15
|
+
require_once('HamlElementNode.php');
|
16
|
+
require_once('HamlFilterNode.php');
|
17
|
+
require_once('HamlHelperNode.php');
|
18
|
+
require_once('HamlCodeBlockNode.php');
|
19
|
+
require_once('HamlNodeExceptions.php');
|
20
|
+
|
21
|
+
/**
|
22
|
+
* HamlNode class.
|
23
|
+
* Base class for all Haml nodes.
|
24
|
+
* @package PHamlP
|
25
|
+
* @subpackage Haml.tree
|
26
|
+
*/
|
27
|
+
class HamlNode {
|
28
|
+
/**
|
29
|
+
* @var HamlNode root node of this node
|
30
|
+
*/
|
31
|
+
protected $root;
|
32
|
+
/**
|
33
|
+
* @var HamlNode parent of this node
|
34
|
+
*/
|
35
|
+
protected $parent;
|
36
|
+
/**
|
37
|
+
* @var array children of this node
|
38
|
+
*/
|
39
|
+
protected $children = array();
|
40
|
+
/**
|
41
|
+
* @var array source line token
|
42
|
+
*/
|
43
|
+
public $token;
|
44
|
+
/**
|
45
|
+
* @var boolean whether to show the output in the browser for debug
|
46
|
+
*/
|
47
|
+
public $showOutput;
|
48
|
+
/**
|
49
|
+
* @var boolean whether to show the source in the browser for debug
|
50
|
+
*/
|
51
|
+
public $showSource;
|
52
|
+
/**
|
53
|
+
* @var string content to render
|
54
|
+
*/
|
55
|
+
public $content;
|
56
|
+
/**
|
57
|
+
* @var string output buffer
|
58
|
+
*/
|
59
|
+
protected $output;
|
60
|
+
/**
|
61
|
+
* @var HamlRenderer Renderer object
|
62
|
+
*/
|
63
|
+
private $_r;
|
64
|
+
/**
|
65
|
+
* @var array Options
|
66
|
+
*/
|
67
|
+
private $_o;
|
68
|
+
|
69
|
+
public function __construct($content, $parent) {
|
70
|
+
$this->content = $content;
|
71
|
+
if (!is_null($parent)) { // $parent === null for "else" code blocks
|
72
|
+
$this->parent = $parent;
|
73
|
+
$this->root = $parent->root;
|
74
|
+
$parent->children[] = $this;
|
75
|
+
}
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Getter.
|
81
|
+
* @param string name of property to get
|
82
|
+
* @return mixed return value of getter function
|
83
|
+
*/
|
84
|
+
public function __get($name) {
|
85
|
+
$getter = 'get' . ucfirst($name);
|
86
|
+
if (method_exists($this, $getter)) {
|
87
|
+
return $this->$getter();
|
88
|
+
}
|
89
|
+
throw new HamlNodeException('No getter function for {what}', array('{what}'=>$name));
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Setter.
|
94
|
+
* @param string name of property to set
|
95
|
+
* @return mixed value of property
|
96
|
+
* @return HamlNode this node
|
97
|
+
*/
|
98
|
+
public function __set($name, $value) {
|
99
|
+
$setter = 'set' . ucfirst($name);
|
100
|
+
if (method_exists($this, $setter)) {
|
101
|
+
$this->$setter($value);
|
102
|
+
return $this;
|
103
|
+
}
|
104
|
+
throw new HamlNodeException('No setter function for {what}', array('{what}'=>$name));
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Return a value indicating if this node has a parent
|
109
|
+
* @return array the node's parent
|
110
|
+
*/
|
111
|
+
public function hasParent() {
|
112
|
+
return !empty($this->parent);
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Returns the node's content and that of its child nodes
|
117
|
+
* @param integer the indent level. This is to allow properly indented output
|
118
|
+
* that filters (e.g. Sass) may need.
|
119
|
+
* @return string the node's content and that of its child nodes
|
120
|
+
*/
|
121
|
+
public function getContent($indentLevel = 0) {
|
122
|
+
$output = str_repeat(' ', 2 * $indentLevel++) . $this->content . "\n";
|
123
|
+
foreach ($this->children as $child) {
|
124
|
+
$output .= $child->getContent($indentLevel);
|
125
|
+
} // foreach
|
126
|
+
return $output;
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Returns the node's parent
|
131
|
+
* @return array the node's parent
|
132
|
+
*/
|
133
|
+
public function getParent() {
|
134
|
+
return $this->parent;
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Returns a value indicating if this node has children
|
139
|
+
* @return boolean true if the node has children, false if not
|
140
|
+
*/
|
141
|
+
public function hasChildren() {
|
142
|
+
return !empty($this->children);
|
143
|
+
}
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Returns the node's children
|
147
|
+
* @return array the node's children
|
148
|
+
*/
|
149
|
+
public function getChildren() {
|
150
|
+
return $this->children;
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Returns the last child node of this node.
|
155
|
+
* @return HamlNode the last child node of this node
|
156
|
+
*/
|
157
|
+
public function getLastChild() {
|
158
|
+
return $this->children[count($this->children) - 1];
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Returns the indent level of this node.
|
163
|
+
* @return integer the indent level of this node
|
164
|
+
*/
|
165
|
+
private function getLevel() {
|
166
|
+
return $this->token['level'];
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Sets the indent level of this node.
|
171
|
+
* Used during rendering to give correct indentation.
|
172
|
+
* @param integer the indent level of this node
|
173
|
+
* @return HamlNode this node
|
174
|
+
*/
|
175
|
+
private function setLevel($level) {
|
176
|
+
$this->token['level'] = $level;
|
177
|
+
return $this;
|
178
|
+
}
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Returns the source for this node
|
182
|
+
* @return string the source for this node
|
183
|
+
*/
|
184
|
+
private function getSource() {
|
185
|
+
return $this->token[HamlParser::HAML_SOURCE];
|
186
|
+
}
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Returns the source for this node
|
190
|
+
* @return string the source for this node
|
191
|
+
*/
|
192
|
+
private function getLine() {
|
193
|
+
return $this->token['line'];
|
194
|
+
}
|
195
|
+
|
196
|
+
/**
|
197
|
+
* Returns the filename for this node
|
198
|
+
* @return string the filename for this node
|
199
|
+
*/
|
200
|
+
private function getFilename() {
|
201
|
+
return $this->token['filename'];
|
202
|
+
}
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Returns the options.
|
206
|
+
* @return array the options
|
207
|
+
*/
|
208
|
+
public function getOptions() {
|
209
|
+
if (empty($this->_o)) {
|
210
|
+
$this->_r = $this->root->options;
|
211
|
+
}
|
212
|
+
return $this->_o;
|
213
|
+
}
|
214
|
+
|
215
|
+
/**
|
216
|
+
* Returns the renderer.
|
217
|
+
* @return HamlRenderer the rendered
|
218
|
+
*/
|
219
|
+
public function getRenderer() {
|
220
|
+
if (empty($this->_r)) {
|
221
|
+
$this->_r = $this->root->renderer;
|
222
|
+
}
|
223
|
+
return $this->_r;
|
224
|
+
}
|
225
|
+
|
226
|
+
public function render() {
|
227
|
+
$output = $this->renderer->renderContent($this);
|
228
|
+
foreach ($this->children as $child) {
|
229
|
+
$output .= $child->render();
|
230
|
+
} // foreach
|
231
|
+
return $this->debug($output);
|
232
|
+
}
|
233
|
+
|
234
|
+
protected function debug($output) {
|
235
|
+
$output = ($this->showSource ? $this->showSource($output) : $output);
|
236
|
+
return ($this->showOutput && $this->line['indentLevel'] == 0 ?
|
237
|
+
nl2br(str_replace(' ', ' ', htmlspecialchars($output))) :
|
238
|
+
$output);
|
239
|
+
}
|
240
|
+
|
241
|
+
/**
|
242
|
+
* Adds a comment with source debug information for the current line to the output.
|
243
|
+
* The debug information is:
|
244
|
+
* + source file (relative to the application path)
|
245
|
+
* + line number
|
246
|
+
* + indent level
|
247
|
+
* + source code
|
248
|
+
* @param array source line(s) that generated the ouput
|
249
|
+
*/
|
250
|
+
protected function showSource($output) {
|
251
|
+
return "<!--\n ({$this->line['file']} {$this->line['number']}:{$this->line['indentLevel']})\n {$this->line[HamlParser::HAML_SOURCE]}\n-->\n$output";
|
252
|
+
}
|
253
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?php
|
2
|
+
/* SVN FILE: $Id: HamlNodeExceptions.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
|
3
|
+
/**
|
4
|
+
* HamlNode exception classes.
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
8
|
+
* @package PHamlP
|
9
|
+
* @subpackage Haml.tree
|
10
|
+
*/
|
11
|
+
|
12
|
+
require_once(dirname(__FILE__).'/../HamlException.php');
|
13
|
+
|
14
|
+
/**
|
15
|
+
* HamlNodeException class.
|
16
|
+
* @package PHamlP
|
17
|
+
* @subpackage Haml.tree
|
18
|
+
*/
|
19
|
+
class HamlNodeException extends HamlException {}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<?php
|
2
|
+
/* SVN FILE: $Id: HamlRootNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
|
3
|
+
/**
|
4
|
+
* HamlRootNode class file.
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
8
|
+
* @package PHamlP
|
9
|
+
* @subpackage Haml.tree
|
10
|
+
*/
|
11
|
+
|
12
|
+
require_once(dirname(__FILE__).'/../renderers/HamlRenderer.php');
|
13
|
+
|
14
|
+
/**
|
15
|
+
* HamlRootNode class.
|
16
|
+
* Also the root node of a document.
|
17
|
+
* @package PHamlP
|
18
|
+
* @subpackage Haml.tree
|
19
|
+
*/
|
20
|
+
class HamlRootNode extends HamlNode {
|
21
|
+
/**
|
22
|
+
* @var HamlRenderer the renderer for this node
|
23
|
+
*/
|
24
|
+
protected $renderer;
|
25
|
+
/**
|
26
|
+
* @var array options
|
27
|
+
*/
|
28
|
+
protected $options;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Root HamlNode constructor.
|
32
|
+
* @param array options for the tree
|
33
|
+
* @return HamlNode
|
34
|
+
*/
|
35
|
+
public function __construct($options) {
|
36
|
+
$this->root = $this;
|
37
|
+
$this->options = $options;
|
38
|
+
$this->renderer = HamlRenderer::getRenderer($this->options['style'],
|
39
|
+
array(
|
40
|
+
'format' => $this->options['format'],
|
41
|
+
'attrWrapper' => $this->options['attrWrapper'],
|
42
|
+
'minimizedAttributes' => $this->options['minimizedAttributes'],
|
43
|
+
)
|
44
|
+
);
|
45
|
+
$this->token = array('level' => -1);
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Render this node.
|
50
|
+
* @return string the rendered node
|
51
|
+
*/
|
52
|
+
public function render() {
|
53
|
+
foreach ($this->children as $child) {
|
54
|
+
$this->output .= $child->render();
|
55
|
+
} // foreach
|
56
|
+
return $this->output;
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?php
|
2
|
+
/* SVN FILE: $Id: SassException.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
|
3
|
+
/**
|
4
|
+
* Sass exception.
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
8
|
+
* @package PHamlP
|
9
|
+
* @subpackage Sass
|
10
|
+
*/
|
11
|
+
|
12
|
+
require_once(dirname(__FILE__).'/../PhamlpException.php');
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Sass exception class.
|
16
|
+
* @package PHamlP
|
17
|
+
* @subpackage Sass
|
18
|
+
*/
|
19
|
+
class SassException extends PhamlpException {
|
20
|
+
/**
|
21
|
+
* Sass Exception.
|
22
|
+
* @param string Exception message
|
23
|
+
* @param array parameters to be applied to the message using <code>strtr</code>.
|
24
|
+
* @param object object with source code and meta data
|
25
|
+
*/
|
26
|
+
public function __construct($message, $params = array(), $object = null) {
|
27
|
+
parent::__construct('sass', $message, $params, $object);
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,164 @@
|
|
1
|
+
<?php
|
2
|
+
/* SVN FILE: $Id: SassFile.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
|
3
|
+
/**
|
4
|
+
* SassFile class file.
|
5
|
+
* File handling utilites.
|
6
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
7
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
8
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
9
|
+
* @package PHamlP
|
10
|
+
* @subpackage Sass
|
11
|
+
*/
|
12
|
+
|
13
|
+
/**
|
14
|
+
* SassFile class.
|
15
|
+
* @package PHamlP
|
16
|
+
* @subpackage Sass
|
17
|
+
*/
|
18
|
+
class SassFile {
|
19
|
+
const SASS = 'sass';
|
20
|
+
const SCSS = 'scss';
|
21
|
+
const SASSC = 'sassc';
|
22
|
+
|
23
|
+
private static $extensions = array(self::SASS, self::SCSS);
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Returns the parse tree for a file.
|
27
|
+
* If caching is enabled a cached version will be used if possible; if not the
|
28
|
+
* parsed file will be cached.
|
29
|
+
* @param string filename to parse
|
30
|
+
* @param SassParser Sass parser
|
31
|
+
* @return SassRootNode
|
32
|
+
*/
|
33
|
+
public static function getTree($filename, $parser) {
|
34
|
+
if ($parser->cache) {
|
35
|
+
$cached = self::getCachedFile($filename, $parser->cache_location);
|
36
|
+
if ($cached !== false) {
|
37
|
+
return $cached;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
$sassParser = new SassParser(array_merge($parser->options, array('line'=>1)));
|
42
|
+
$tree = $sassParser->parse($filename);
|
43
|
+
if ($parser->cache) {
|
44
|
+
self::setCachedFile($tree, $filename, $parser->cache_location);
|
45
|
+
}
|
46
|
+
return $tree;
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Returns the full path to a file to parse.
|
51
|
+
* The file is looked for recursively under the load_paths directories and
|
52
|
+
* the template_location directory.
|
53
|
+
* If the filename does not end in .sass or .scss try the current syntax first
|
54
|
+
* then, if a file is not found, try the other syntax.
|
55
|
+
* @param string filename to find
|
56
|
+
* @param SassParser Sass parser
|
57
|
+
* @return string path to file
|
58
|
+
* @throws SassException if file not found
|
59
|
+
*/
|
60
|
+
public static function getFile($filename, $parser) {
|
61
|
+
$ext = substr($filename, -5);
|
62
|
+
|
63
|
+
foreach (self::$extensions as $i=>$extension) {
|
64
|
+
if ($ext !== '.'.self::SASS && $ext !== '.'.self::SCSS) {
|
65
|
+
if ($i===0) {
|
66
|
+
$_filename = "$filename.{$parser->syntax}";
|
67
|
+
}
|
68
|
+
else {
|
69
|
+
$_filename = $filename.'.'.($parser->syntax === self::SASS ? self::SCSS : self::SASS);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
else {
|
73
|
+
$_filename = $filename;
|
74
|
+
}
|
75
|
+
|
76
|
+
if (file_exists($_filename)) {
|
77
|
+
return $_filename;
|
78
|
+
}
|
79
|
+
|
80
|
+
foreach (array_merge(array(dirname($parser->filename)), $parser->load_paths) as $loadPath) {
|
81
|
+
$path = self::findFile($_filename, realpath($loadPath));
|
82
|
+
if ($path !== false) {
|
83
|
+
return $path;
|
84
|
+
}
|
85
|
+
} // foreach
|
86
|
+
|
87
|
+
if (!empty($parser->template_location)) {
|
88
|
+
$path = self::findFile($_filename, realpath($parser->template_location));
|
89
|
+
if ($path !== false) {
|
90
|
+
return $path;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
throw new SassException('Unable to find {what}: {filename}', array('{what}'=>'import file', '{filename}'=>$filename));
|
96
|
+
}
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Looks for the file recursively in the specified directory.
|
100
|
+
* This will also look for _filename to handle Sass partials.
|
101
|
+
* @param string filename to look for
|
102
|
+
* @param string path to directory to look in and under
|
103
|
+
* @return mixed string: full path to file if found, false if not
|
104
|
+
*/
|
105
|
+
public static function findFile($filename, $dir) {
|
106
|
+
$partialname = dirname($filename).DIRECTORY_SEPARATOR.'_'.basename($filename);
|
107
|
+
|
108
|
+
foreach (array($filename, $partialname) as $file) {
|
109
|
+
if (file_exists($dir . DIRECTORY_SEPARATOR . $file)) {
|
110
|
+
return realpath($dir . DIRECTORY_SEPARATOR . $file);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
$files = array_slice(scandir($dir), 2);
|
115
|
+
|
116
|
+
foreach ($files as $file) {
|
117
|
+
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
|
118
|
+
$path = self::findFile($filename, $dir . DIRECTORY_SEPARATOR . $file);
|
119
|
+
if ($path !== false) {
|
120
|
+
return $path;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
} // foreach
|
124
|
+
return false;
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Returns a cached version of the file if available.
|
129
|
+
* @param string filename to fetch
|
130
|
+
* @param string path to cache location
|
131
|
+
* @return mixed the cached file if available or false if it is not
|
132
|
+
*/
|
133
|
+
public static function getCachedFile($filename, $cacheLocation) {
|
134
|
+
$cached = realpath($cacheLocation) . DIRECTORY_SEPARATOR .
|
135
|
+
md5($filename) . '.'.self::SASSC;
|
136
|
+
|
137
|
+
if ($cached && file_exists($cached) &&
|
138
|
+
filemtime($cached) >= filemtime($filename)) {
|
139
|
+
return unserialize(file_get_contents($cached));
|
140
|
+
}
|
141
|
+
return false;
|
142
|
+
}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Saves a cached version of the file.
|
146
|
+
* @param SassRootNode Sass tree to save
|
147
|
+
* @param string filename to save
|
148
|
+
* @param string path to cache location
|
149
|
+
* @return mixed the cached file if available or false if it is not
|
150
|
+
*/
|
151
|
+
public static function setCachedFile($sassc, $filename, $cacheLocation) {
|
152
|
+
$cacheDir = realpath($cacheLocation);
|
153
|
+
|
154
|
+
if (!$cacheDir) {
|
155
|
+
mkdir($cacheLocation);
|
156
|
+
@chmod($cacheLocation, 0777);
|
157
|
+
$cacheDir = realpath($cacheLocation);
|
158
|
+
}
|
159
|
+
|
160
|
+
$cached = $cacheDir . DIRECTORY_SEPARATOR . md5($filename) . '.'.self::SASSC;
|
161
|
+
|
162
|
+
return file_put_contents($cached, serialize($sassc));
|
163
|
+
}
|
164
|
+
}
|