1
0
Fork 0

fix css_compress + include .idea/

This commit is contained in:
Mike Schwörer 2018-01-19 22:49:46 +01:00
parent bfa6b89860
commit 40ca6e8d96
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
21 changed files with 227 additions and 9 deletions

9
.gitignore vendored
View File

@ -1,7 +1,8 @@
.idea
demos
#www/images/programs
workspace.xml
*.secret
.idea/
runtime/
**/.idea/workspace.xml
**/.idea/tasks.xml
**/.idea/dataSources*

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
www.mikescher.de

8
.idea/Source.iml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
</value>
</option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</component>
</project>

View File

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

14
.idea/deployment.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData">
<serverData>
<paths name="local_xampp">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="Mike" />
</component>

5
.idea/encodings.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="FrameworkRootSettings" id="Yii">
<option name="typedPaths">
<list>
<element elementPath="$PROJECT_DIR$/www/assets" typeId="assets_directory" />
<element elementPath="$PROJECT_DIR$/www/protected" typeId="protected_directory" />
<element elementPath="$PROJECT_DIR$/www/protected/controllers" typeId="protected_controllers_directory" />
<element elementPath="$PROJECT_DIR$/www/protected/extensions" typeId="protected_extensions_directory" />
<element elementPath="$PROJECT_DIR$/www/protected/models" typeId="protected_models_directory" />
<element elementPath="$PROJECT_DIR$/www/protected/runtime" typeId="protected_runtime_directory" />
<element elementPath="$PROJECT_DIR$/www/protected/views" typeId="protected_views_directory" />
<element elementPath="$PROJECT_DIR$/www/protected/views/layouts" typeId="protected_views_layouts_directory" />
<element elementPath="$PROJECT_DIR$/www/themes" typeId="themes_directory" />
</list>
</option>
</component>
</project>

View File

@ -0,0 +1,11 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

6
.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/www.mikescher.de.iml" filepath="$PROJECT_DIR$/.idea/www.mikescher.de.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

6
.idea/sqldialects.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="PROJECT" dialect="MySQL" />
</component>
</project>

7
.idea/vcs.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

45
.idea/watcherTasks.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectTasksOptions" suppressed-tasks="Babel">
<TaskOptions isEnabled="false">
<option name="arguments" value="--no-cache --update styles.scss:styles.css" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="scss" />
<option name="immediateSync" value="true" />
<option name="name" value="SCSS" />
<option name="output" value="styles.css:styles.css.map" />
<option name="outputFilters">
<array />
</option>
<option name="outputFromStdout" value="false" />
<option name="program" value="C:/TOOLS/Ruby/bin/scss.bat" />
<option name="runOnExternalChanges" value="true" />
<option name="scopeName" value="Project Files" />
<option name="trackOnlyRoot" value="true" />
<option name="workingDir" value="$FileDir$" />
<envs />
</TaskOptions>
<TaskOptions isEnabled="true">
<option name="arguments" value="&quot;F:\Eigene Dateien\Dropbox\Programming\Web\Website - Mikescher\Source\data\css_compress\compress.py&quot; &quot;$FileDir$\styles.scss&quot; &quot;$FileDir$\styles.css&quot; &quot;$FileDir$\styles.min.css&quot;" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ALWAYS" />
<option name="fileExtension" value="scss" />
<option name="immediateSync" value="true" />
<option name="name" value="SCSS + Minimize" />
<option name="output" value="styles.min.css:styles.css:styles.css.map" />
<option name="outputFilters">
<array />
</option>
<option name="outputFromStdout" value="false" />
<option name="program" value="C:/TOOLS/python3/python.exe" />
<option name="runOnExternalChanges" value="true" />
<option name="scopeName" value="Project Files" />
<option name="trackOnlyRoot" value="true" />
<option name="workingDir" value="$PROJECT_DIR$/data/css_compress/" />
<envs />
</TaskOptions>
</component>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/www" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/demos" />
<excludePattern pattern="*.css" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -24,39 +24,64 @@ def countnl(str, start, end):
if (str[i] == '\n'): cnt = cnt+1;
return cnt;
finput = str.replace(sys.argv[1], '\\', '/')
foutput = str.replace(sys.argv[2], '\\', '/')
fsource = str.replace(sys.argv[1], '\\', '/') # scss
finput = str.replace(sys.argv[2], '\\', '/') # css
foutput = str.replace(sys.argv[3], '\\', '/') # min.css
ftemp = '__temp_compresss_py_yui.tmp.css';
print('======== INPUT ========');
print();
print(fsource);
print(finput);
print(foutput);
print();
print();
print('======== CALL SCSS ========');
out = subprocess.run(['C:/TOOLS/Ruby/bin/scss.bat', '--no-cache', '--update', fsource + ':' + finput], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print('> C:/TOOLS/Ruby/bin/scss.bat --no-cache --update ' + fsource + ':' + finput)
print('STDOUT:')
print(out.stdout.decode('utf-8'))
print('STDERR:')
print(out.stderr.decode('utf-8'))
print('======== CALL ========');
#os.system("java -jar yuicompressor.jar \""+finput+"\" -o \""+ftemp+"\"")
print('')
print('')
print('======== CALL YUI ========');
out = subprocess.run(['java', '-jar', 'yuicompressor.jar', finput, '-o', ftemp], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print('> java -jar yuicompressor.jar "'+finput+'" -o "'+ftemp+'"')
print('STDOUT:');
print(out.stdout.decode('utf-8'))
print('STDERR:');
print(out.stderr.decode('utf-8'))
print('')
print('')
print('======== READ ========');
with open(ftemp, 'r') as tf:
data = tf.read()
print('')
print('')
print('======== REM ========');
try:
os.remove(ftemp);
except e:
print(e)
print('')
print('')
print('======== REGEX ========');
data = re.sub(r'(\}*\})', '\g<1>\n', data);
print('')
print('')
print('======== MEDIA ========');
ins = []
for i in range(len(data)):
@ -78,6 +103,13 @@ for i in range(len(data)):
for (l, c) in reversed(ins):
data = data[:l] + c + data[l:]
print('')
print('')
print('======== WRITE ========');
with open(foutput, "w") as tf:
tf.write(data)
tf.write(data)
print('')
print('')
print('Sinished.')