2

i've some issues with auto generating static files in pub/static folder

after use magento setup:static-content:deploy if i delete some static file generated by deploy like css and i point to the url like:

<my_domain>/pub/static/frontend/<my_module>/<my_theme>/en_US/css/theme.css

magento2 not auto generated it anymore... i need some tips!

  • i'm in developer mode
  • i've clear var/cache and var/view_preprocessed folders
  • i've flushed magento2 cache
  • i've set Server side less compilation
  • if i use magento setup:static-content:deploy all works perfectly!
asked Jun 1, 2016 at 10:07
3
  • you need to run magento setup:static-content:deploy to generate deleted file. as you said it works fine , the file will not generate automatically unless you run deploy command. Commented Jun 1, 2016 at 10:17
  • this is not a real question. why should you expect something to work if you delete files? Commented Jun 1, 2016 at 11:02
  • cause some days ago it works, to recompile less for example i delete file in pub/static/[***]/css and var/view_preprocessed and refresh the page Commented Jun 1, 2016 at 12:04

1 Answer 1

2

I've resolve this issues, for my mistake i've delete the .htaccess from pub\static

<IfModule mod_php5.c>
php_flag engine 0
</IfModule>
<IfModule mod_php7.c>
php_flag engine 0
</IfModule>
# To avoid situation when web server automatically adds extension to path
Options -MultiViews
<IfModule mod_rewrite.c>
 RewriteEngine On
 # Remove signature of the static files that is used to overcome the browser cache
 RewriteRule ^version.+?/(.+)$ 1ドル [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-l
 RewriteRule .* ../static.php?resource=0ドル [L]
</IfModule>
############################################
## setting MIME types
# JavaScript
AddType application/javascript js jsonp
AddType application/json json
# CSS
AddType text/css css
# Images and icons
AddType image/x-icon ico
AddType image/gif gif
AddType image/png png
AddType image/jpeg jpg
AddType image/jpeg jpeg
# SVG
AddType image/svg+xml svg
# Fonts
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf
AddType application/x-font-otf otf
AddType application/x-font-woff woff
AddType application/font-woff2 woff2
# Flash
AddType application/x-shockwave-flash swf
# Archives and exports
AddType application/zip gzip
AddType application/x-gzip gz gzip
AddType application/x-bzip2 bz2
AddType text/csv csv
AddType application/xml xml
<IfModule mod_headers.c>
 <FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$>
 Header append Cache-Control public
 </FilesMatch>
 <FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$>
 Header append Cache-Control no-store
 </FilesMatch>
</IfModule>
<IfModule mod_expires.c>
############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
 ExpiresActive On
 # Data
 <FilesMatch \.(zip|gz|gzip|bz2|csv|xml)$>
 ExpiresDefault "access plus 0 seconds"
 </FilesMatch>
 ExpiresByType text/xml "access plus 0 seconds"
 ExpiresByType text/csv "access plus 0 seconds"
 ExpiresByType application/json "access plus 0 seconds"
 ExpiresByType application/zip "access plus 0 seconds"
 ExpiresByType application/x-gzip "access plus 0 seconds"
 ExpiresByType application/x-bzip2 "access plus 0 seconds"
 # CSS, JavaScript
 <FilesMatch \.(css|js)$>
 ExpiresDefault "access plus 1 year"
 </FilesMatch>
 ExpiresByType text/css "access plus 1 year"
 ExpiresByType application/javascript "access plus 1 year"
 # Favicon, images, flash
 <FilesMatch \.(ico|gif|png|jpg|jpeg|swf|svg)$>
 ExpiresDefault "access plus 1 year"
 </FilesMatch>
 ExpiresByType image/gif "access plus 1 year"
 ExpiresByType image/png "access plus 1 year"
 ExpiresByType image/jpg "access plus 1 year"
 ExpiresByType image/jpeg "access plus 1 year"
 ExpiresByType image/svg+xml "access plus 1 year"
 # Fonts
 <FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$>
 ExpiresDefault "access plus 1 year"
 </FilesMatch>
 ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
 ExpiresByType application/x-font-ttf "access plus 1 year"
 ExpiresByType application/x-font-otf "access plus 1 year"
 ExpiresByType application/x-font-woff "access plus 1 year"
 ExpiresByType application/font-woff2 "access plus 1 year"
</IfModule>

Thanks to Emizen Tech

answered Jun 1, 2016 at 13:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.